Function multiaddr::from_url_lossy

source ·
pub fn from_url_lossy(url: &str) -> Result<Multiaddr, FromUrlErr>
Expand description

Attempts to parse an URL into a multiaddress. Ignores possible loss of information.

This function is similar to from_url, except that we don’t return an error if some information in the URL cannot be retain in the generated multiaddres.

This function is only present if the url feature is enabled, and it is enabled by default.

Example

let addr = "ws://user:pass@127.0.0.1:8080/";
assert!(multiaddr::from_url(addr).is_err());
assert!(multiaddr::from_url_lossy(addr).is_ok());