pub struct IRI { /* private fields */ }
Expand description
Re-export of all parts of the mail_core
crate.
Some parts like error
/default_impl
will get overridden.
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§
Source§impl IRI
impl IRI
Sourcepub fn from_parts(scheme: &str, tail: &str) -> Result<IRI, InvalidIRIScheme>
pub fn from_parts(scheme: &str, tail: &str) -> Result<IRI, InvalidIRIScheme>
Create a new IRI from a scheme part and a tail part.
This will convert the scheme part into lower case before using it.
Sourcepub fn new<I>(iri: I) -> Result<IRI, InvalidIRIScheme>
pub fn new<I>(iri: I) -> Result<IRI, InvalidIRIScheme>
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
Sourcepub fn with_tail(&self, new_tail: &str) -> IRI
pub fn with_tail(&self, new_tail: &str) -> IRI
Creates a new IRI with the same schema but a different tail.
Sourcepub fn scheme(&self) -> &str
pub fn scheme(&self) -> &str
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");
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IRI
impl<'de> Deserialize<'de> for IRI
Source§fn deserialize<D>(
deserializer: D,
) -> Result<IRI, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<IRI, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Ord for IRI
impl Ord for IRI
Source§impl PartialOrd for IRI
impl PartialOrd for IRI
Source§impl PathRebaseable for IRI
impl PathRebaseable for IRI
Source§fn rebase_to_include_base_dir(
&mut self,
base_dir: impl AsRef<Path>,
) -> Result<(), UnsupportedPathError>
fn rebase_to_include_base_dir( &mut self, base_dir: impl AsRef<Path>, ) -> Result<(), UnsupportedPathError>
base_dir
. Read moreSource§fn rebase_to_exclude_base_dir(
&mut self,
base_dir: impl AsRef<Path>,
) -> Result<(), UnsupportedPathError>
fn rebase_to_exclude_base_dir( &mut self, base_dir: impl AsRef<Path>, ) -> Result<(), UnsupportedPathError>
base_dir
prefix. Read more