pub struct CanonicalUrl(/* private fields */);Expand description
A wrapper around Url which represents a “canonical” version of an original URL.
A “canonical” url is only intended for internal comparison purposes. It’s to help paper over
mistakes such as depending on github.com/foo/bar vs. github.com/foo/bar.git.
This is only for internal purposes and provides no means to actually read the underlying
string value of the Url it contains. This is intentional, because all fetching should still
happen within the context of the original URL.
Implementations§
Source§impl CanonicalUrl
impl CanonicalUrl
pub fn new(url: &DisplaySafeUrl) -> Self
pub fn parse(url: &str) -> Result<Self, DisplaySafeUrlError>
Trait Implementations§
Source§impl CacheKey for CanonicalUrl
impl CacheKey for CanonicalUrl
fn cache_key(&self, state: &mut CacheKeyHasher)
fn cache_key_slice(data: &[Self], state: &mut CacheKeyHasher)where
Self: Sized,
Source§impl Clone for CanonicalUrl
impl Clone for CanonicalUrl
Source§fn clone(&self) -> CanonicalUrl
fn clone(&self) -> CanonicalUrl
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CanonicalUrl
impl Debug for CanonicalUrl
Source§impl Display for CanonicalUrl
impl Display for CanonicalUrl
Source§impl From<CanonicalUrl> for DisplaySafeUrl
impl From<CanonicalUrl> for DisplaySafeUrl
Source§fn from(value: CanonicalUrl) -> Self
fn from(value: CanonicalUrl) -> Self
Converts to this type from the input type.
Source§impl Hash for CanonicalUrl
impl Hash for CanonicalUrl
Source§impl Ord for CanonicalUrl
impl Ord for CanonicalUrl
Source§fn cmp(&self, other: &CanonicalUrl) -> Ordering
fn cmp(&self, other: &CanonicalUrl) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CanonicalUrl
impl PartialEq for CanonicalUrl
Source§impl PartialOrd for CanonicalUrl
impl PartialOrd for CanonicalUrl
impl Eq for CanonicalUrl
impl StructuralPartialEq for CanonicalUrl
Auto Trait Implementations§
impl Freeze for CanonicalUrl
impl RefUnwindSafe for CanonicalUrl
impl Send for CanonicalUrl
impl Sync for CanonicalUrl
impl Unpin for CanonicalUrl
impl UnwindSafe for CanonicalUrl
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