ChrisMacNaughton/vault-rs

TryFrom Url

Closed this issue · 1 comments

I think the url library pulled into this crate isn't new enough. I'm seeing the following error with vault_host being type String:

33  |         let vault_client = VaultClient::new(&vault_host, &token)?;
    |                            ^^^^^^^^^^^^^^^^ the trait `hashicorp_vault::TryFrom<&std::string::String>` is not implemented for `url::Url`
    | 
   ::: /Users/cholcombe/.cargo/registry/src/github.com-1ecc6299db9ec823/hashicorp_vault-1.0.0/src/client/mod.rs:654:12
    |
654 |         U: TryInto<Url, Err = Error>,
    |            ------------------------- required by this bound in `hashicorp_vault::client::VaultClient::<hashicorp_vault::client::TokenData>::new`
    |
    = help: the following implementations were found:
              <url::Url as hashicorp_vault::TryFrom<&'a str>>
              <url::Url as hashicorp_vault::TryFrom<&'a url::Url>>
              <url::Url as hashicorp_vault::TryFrom<url::Url>>
    = note: required because of the requirements on the impl of `hashicorp_vault::TryInto<url::Url>` for `&std::string::String`

TryFrom is implemented in version 2.0 of url but it doesn't seem to be in 1.5.x which this crate uses. It works fine if i manually pull in the url 1.5.x crate and do a Url::parse(&str)

It turns out that we implement TryFrom for all types to Url internally :-D