pub struct Url(_);
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 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<Url> for Url
impl PartialOrd<Url> for Url
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 more