Struct iri_string::absolute::AbsoluteIri
[−]
[src]
pub struct AbsoluteIri { /* fields omitted */ }
Absolute IRI and resolved URI.
Comparations (PartialEq
, Eq
, PartialOrd
, Ord
, Hash
implementations) are done by raw IRI comparison (returned by
[AbsoluteIri::raw
]), not by resolved one (returned by
[AbsoluteIri::resolved
]).
Methods
impl AbsoluteIri
[src]
pub fn new<S: AsRef<str> + Into<String>>(s: S) -> Result<Self, UrlParseError>
[src]
Creates a new AbsoluteIri
.
Examples
let s = "https://例.example.com/example/テスト"; assert!(AbsoluteIri::new(s).is_ok()); assert!(AbsoluteIri::new("not-absolute-iri").is_err());
pub fn raw(&self) -> &AbsoluteIriStr
[src]
Returns raw IRI string slice.
Examples
let s = "https://例.example.com/example/テスト"; let iri = AbsoluteIri::new(s).expect("Should never fail"); assert_eq!(iri.raw(), s);
pub fn resolved(&self) -> &Url
[src]
Returns reference to the resolved URI.
Examples
let s = "https://例.example.com/example/テスト"; let resolved = "https://xn--fsq.example.com/example/%E3%83%86%E3%82%B9%E3%83%88"; let iri = AbsoluteIri::new(s).expect("Should never fail"); assert_eq!(iri.resolved().as_str(), resolved);
pub fn deconstruct(self) -> (AbsoluteIriString, Url)
[src]
Deconstructs AbsoluteIri
into [AbsoluteIriString
] and [Url
].
Examples
let s = "https://例.example.com/example/テスト"; let resolved_str = "https://xn--fsq.example.com/example/%E3%83%86%E3%82%B9%E3%83%88"; let iri = AbsoluteIri::new(s).expect("Should never fail"); let (raw, resolved) = iri.deconstruct(); assert_eq!(raw, s); assert_eq!(resolved.as_str(), resolved_str);
Trait Implementations
impl Debug for AbsoluteIri
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for AbsoluteIri
[src]
fn clone(&self) -> AbsoluteIri
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for AbsoluteIri
[src]
fn eq(&self, rhs: &AbsoluteIri) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for AbsoluteIri
[src]
impl PartialOrd for AbsoluteIri
[src]
fn partial_cmp(&self, rhs: &AbsoluteIri) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for AbsoluteIri
[src]
fn cmp(&self, rhs: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for AbsoluteIri
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Serialize for AbsoluteIri
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for AbsoluteIri
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more