pub struct Uri(/* private fields */);
Expand description
Newtype struct around fluent_uri::Uri<String>
with serialization implementations that use as_str()
and ‘from_str()’ respectively.
Methods from Deref<Target = Uri<String>>§
sourcepub fn to_owned(&self) -> Uri<String>
pub fn to_owned(&self) -> Uri<String>
Creates a new Uri<String>
by cloning the contents of this Uri<&str>
.
Returns the authority component.
sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Returns true
if the URI reference is relative, i.e., without a scheme.
Note that this method is not the opposite of is_absolute
.
§Examples
use fluent_uri::Uri;
let uri = Uri::parse("/path/to/file")?;
assert!(uri.is_relative());
let uri = Uri::parse("http://example.com/")?;
assert!(!uri.is_relative());
sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Returns true
if the URI reference is absolute, i.e., with a scheme and without a fragment.
Note that this method is not the opposite of is_relative
.
§Examples
use fluent_uri::Uri;
let uri = Uri::parse("http://example.com/")?;
assert!(uri.is_absolute());
let uri = Uri::parse("http://example.com/#title1")?;
assert!(!uri.is_absolute());
let uri = Uri::parse("/path/to/file")?;
assert!(!uri.is_absolute());
Trait Implementations§
source§impl<'de> Deserialize<'de> for Uri
impl<'de> Deserialize<'de> for Uri
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Uri
impl Ord for Uri
source§impl PartialEq for Uri
impl PartialEq for Uri
source§impl PartialOrd for Uri
impl PartialOrd for Uri
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq 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