[−][src]Struct mail::IRI
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");
Implementations
impl IRI
[src]
pub fn from_parts(scheme: &str, tail: &str) -> Result<IRI, InvalidIRIScheme>
[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.
pub fn new<I>(iri: I) -> Result<IRI, InvalidIRIScheme> where
I: Into<String>,
[src]
I: Into<String>,
crates a new a IRI
- this determines the first occurrence of
:
to split the input into scheme and tail - it validates that the scheme name is RFC 3986
compatible, i.e. is ascii, starting with a letter followed by alpha numeric characters
(or
"+"
,"-"
,"."
). - converts the scheme part to lower case
pub fn with_tail(&self, new_tail: &str) -> IRI
[src]
Creates a new IRI with the same schema but a different tail.
pub fn scheme(&self) -> &str
[src]
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");
pub fn tail(&self) -> &str
[src]
the scheme specific part of the uri
Example
let uri = IRI::new("file:///opt/share/logo.png").unwrap(); assert_eq!(uri.scheme(), "file");
pub fn as_str(&self) -> &str
[src]
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 Clone for IRI
[src]
impl Debug for IRI
[src]
impl<'de> Deserialize<'de> for IRI
[src]
fn deserialize<D>(
deserializer: D
) -> Result<IRI, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<IRI, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Eq for IRI
[src]
impl FromStr for IRI
[src]
type Err = InvalidIRIScheme
The associated error which can be returned from parsing.
fn from_str(inp: &str) -> Result<IRI, <IRI as FromStr>::Err>
[src]
impl Hash for IRI
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Into<String> for IRI
[src]
impl Ord for IRI
[src]
fn cmp(&self, other: &IRI) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<IRI> for IRI
[src]
impl PartialOrd<IRI> for IRI
[src]
fn partial_cmp(&self, other: &IRI) -> Option<Ordering>
[src]
fn lt(&self, other: &IRI) -> bool
[src]
fn le(&self, other: &IRI) -> bool
[src]
fn gt(&self, other: &IRI) -> bool
[src]
fn ge(&self, other: &IRI) -> bool
[src]
impl PathRebaseable for IRI
[src]
fn rebase_to_include_base_dir(
&mut self,
base_dir: impl AsRef<Path>
) -> Result<(), UnsupportedPathError>
[src]
&mut self,
base_dir: impl AsRef<Path>
) -> Result<(), UnsupportedPathError>
fn rebase_to_exclude_base_dir(
&mut self,
base_dir: impl AsRef<Path>
) -> Result<(), UnsupportedPathError>
[src]
&mut self,
base_dir: impl AsRef<Path>
) -> Result<(), UnsupportedPathError>
impl Serialize for IRI
[src]
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl StructuralEq for IRI
[src]
impl StructuralPartialEq for IRI
[src]
Auto Trait Implementations
impl RefUnwindSafe for IRI
impl Send for IRI
impl Sync for IRI
impl Unpin for IRI
impl UnwindSafe for IRI
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T> HeaderTryFrom<T> for T
[src]
fn try_from(val: T) -> Result<T, ComponentCreationError>
[src]
impl<F, T> HeaderTryInto<T> for F where
T: HeaderTryFrom<F>,
[src]
T: HeaderTryFrom<F>,
fn try_into(self) -> Result<T, ComponentCreationError>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,