pub struct Url(/* private fields */);
Expand description
A component URL. The URL is validated, but represented as a string to avoid normalization and retain the original representation.
Implementations§
Source§impl Url
impl Url
Sourcepub fn new(url: impl AsRef<str> + Into<String>) -> Result<Url, ParseError>
pub fn new(url: impl AsRef<str> + Into<String>) -> Result<Url, ParseError>
Creates a Url
from a String
, returning an Err
if the string fails
validation. The string must be non-empty, no more than 4096 characters
in length, and be a valid URL. See the url
crate.
Sourcepub fn validate(url_str: &str) -> Result<(), ParseError>
pub fn validate(url_str: &str) -> Result<(), ParseError>
Verifies the given string is a valid absolute or relative component URL.
pub fn is_relative(&self) -> bool
pub fn scheme(&self) -> Option<String>
pub fn resource(&self) -> Option<String>
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Url
impl<'de> Deserialize<'de> for Url
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Url, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Url, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl NativeIntoFidl<String> for Url
impl NativeIntoFidl<String> for Url
fn native_into_fidl(self) -> String
Source§impl Ord for Url
impl Ord for Url
Source§impl PartialOrd for Url
impl PartialOrd for Url
Source§impl Serialize for Url
impl Serialize for Url
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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.