pub struct Url(/* private fields */);Expand description
An RFC3986 URI.
The URI is stored verbatim and only interpreted when a file:// path is actually needed.
Implementations§
Source§impl Url
impl Url
Sourcepub fn parse(input: &str) -> Result<Url, ParseError>
pub fn parse(input: &str) -> Result<Url, ParseError>
Parse an absolute URI. Mirrors url::Url::parse’s rejection of relative
references: the input must begin with a valid scheme (ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ":").
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
The (still percent-encoded) path component, matching url::Url::path.
Sourcepub fn from_file_path<P: AsRef<Path>>(path: P) -> Result<Url, ()>
pub fn from_file_path<P: AsRef<Path>>(path: P) -> Result<Url, ()>
Build a file:// URI from an absolute filesystem path.
Sourcepub fn from_directory_path<P: AsRef<Path>>(path: P) -> Result<Url, ()>
pub fn from_directory_path<P: AsRef<Path>>(path: P) -> Result<Url, ()>
Like Url::from_file_path, but ensures a trailing slash so the URI
denotes a directory.
Sourcepub fn to_file_path(&self) -> Result<PathBuf, ()>
pub fn to_file_path(&self) -> Result<PathBuf, ()>
Convert a file:// URI back to a filesystem path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Url
impl<'de> Deserialize<'de> for Url
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Url
Source§impl Ord for Url
impl Ord for Url
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Url
impl PartialOrd for Url
impl StructuralPartialEq for Url
Auto Trait Implementations§
impl Freeze for Url
impl RefUnwindSafe for Url
impl Send for Url
impl Sync for Url
impl Unpin for Url
impl UnsafeUnpin for Url
impl UnwindSafe for Url
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more