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]

[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());

[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);

[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);

[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]

[src]

Formats the value using the given formatter. Read more

impl Clone for AbsoluteIri
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Serialize for AbsoluteIri
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for AbsoluteIri
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for AbsoluteIri

impl Sync for AbsoluteIri