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<Self, ParseError>
pub fn new(url: impl AsRef<str> + Into<String>) -> Result<Self, 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<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 Url
impl Ord for Url
Source§impl PartialOrd for Url
impl PartialOrd for Url
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
)