Struct iri_string::AbsoluteIri
[−]
[src]
pub struct AbsoluteIri { /* fields omitted */ }
Absolute IRI and resolved URI.
NOTE: For now, it does not derive {,Partial}{Eq,Ord}
and Hash
because it is not sure how they should be ordered or compared by default.
If you want to compare them, use raw absolute IRI (by [AbsoluteIri::raw
])
or resolved URI (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 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