pub struct Uri { /* private fields */ }
Expand description
Encapsulates the URI type.
Implementations§
Source§impl Uri
impl Uri
Sourcepub fn try_new(uri: &str) -> Result<Self>
pub fn try_new(uri: &str) -> Result<Self>
Attempts to construct a Uri
from a raw string slice.
A file://
protocol is assumed if not specified.
File URIs are resolved (normalized) relative to the current working directory
unless an absolute path is specified.
Handles special characters like ~
, .
, ..
.
Sourcepub fn new(uri: String) -> Self
pub fn new(uri: String) -> Self
Constructs a Uri
from a properly formatted string <protocol>://<path>
where path
is
normalized. Use this method exclusively for trusted input.
Sourcepub fn filepath(&self) -> Option<&Path>
pub fn filepath(&self) -> Option<&Path>
Returns the file path of the URI.
Applies only to file://
URIs.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the Uri
struct and returns the normalized URI as a string.
Trait Implementations§
impl Eq for Uri
impl StructuralPartialEq for Uri
Auto Trait Implementations§
impl Freeze for Uri
impl RefUnwindSafe for Uri
impl Send for Uri
impl Sync for Uri
impl Unpin for Uri
impl UnwindSafe for Uri
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.