[][src]Struct mail_core::IRI

pub struct IRI { /* fields omitted */ }

A minimal IRI (International Resource Identifier) implementation which just parses the scheme but no scheme specific part (and neither fragments wrt. those definitions in which fragments are not scheme specific parts).

This implementation does not perform any form of normalization or other IRI specific aspects, it's basically just a String split into two parts.

Additionally this implementations requires all URI to be valid utf8.

Example

let uri = IRI::new("file:/random/logo.png").unwrap();
assert_eq!(uri.scheme(), "file");
assert_eq!(uri.tail(), "/random/logo.png");

Methods

impl IRI
[src]

Create a new IRI from a scheme part and a tail part.

This will convert the scheme part into lower case before using it.

crates a new a IRI

  1. this determines the first occurrence of : to split the input into scheme and tail
  2. it validates that the scheme name is RFC 3986 compatible, i.e. is ascii, starting with a letter followed by alpha numeric characters (or "+","-",".").
  3. converts the scheme part to lower case

Creates a new IRI with the same schema but a different tail.

The scheme part of the uri excluding the : seperator.

The scheme is guaranteed to be lower case.

Example

let uri = IRI::new("file:///opt/share/logo.png").unwrap();
assert_eq!(uri.scheme(), "file");

the scheme specific part of the uri

Example

let uri = IRI::new("file:///opt/share/logo.png").unwrap();
assert_eq!(uri.scheme(), "file");

returns the underlying string representation

Note that it does not implement Display even through it implements as_str and Into<String> as displaying a IRI is more complex then just displaying a string (mainly due to bidirectional IRI's).

Trait Implementations

impl Ord for IRI
[src]

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl PartialEq<IRI> for IRI
[src]

impl Clone for IRI
[src]

Performs copy-assignment from source. Read more

impl Eq for IRI
[src]

impl Into<String> for IRI
[src]

impl PartialOrd<IRI> for IRI
[src]

impl Debug for IRI
[src]

impl FromStr for IRI
[src]

The associated error which can be returned from parsing.

impl Hash for IRI
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for IRI

impl Sync for IRI

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<F, T> HeaderTryInto for F where
    T: HeaderTryFrom<F>, 
[src]

impl<T> HeaderTryFrom for T
[src]

impl<T> Erased for T