hi ...
Some assistance needed
I am trying to use the following function:
https://docs.rs/url/1.7.2/src/url/lib.rs.html#303-305
/// Parse an absolute URL from a string.
///
/// # Examples
///
/// ```rust
/// use url::Url;
/// # use url::ParseError;
///
/// # fn run() -> Result<(), ParseError> {
/// let url = Url::parse("https://example.net")?;
/// # Ok(())
/// # }
/// # run().unwrap();
/// ```
///
/// # Errors
///
/// If the function can not parse an absolute URL from the given string,
/// a [`ParseError`] variant will be returned.
///
/// [`ParseError`]: enum.ParseError.html
#[inline]
pub fn parse(input: &str) -> Result<Url, ::ParseError> {
Url::options().parse(input)
}
if I use it as :
fn main(){
let url = "https://bla/bla";
let x = Url::parse(url).unwrap();
}
No problem. But if I have a string:
fn main(){
let url = "https://bla/bla".to_string();
let x = Url::parse(&url).unwrap();
}
i get:
thread 'Map' panicked at 'called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Any help ?