[−][src]Enum mail_chars::Charset
An enum for the charsets represented through an internal lookup table.
Variants
qtext
+ ws
, basically anything which can appear in a quoted string
which is not a quoted-pair.
Note: this is equivalent to rfc7230 qdtext
, excluding the obsolete
part of the grammar.
Note: the obsolete part of the grammar is excluded
rfc: 5322
ctext
+ ws
Note: the obsolete part of the grammar is excluded.
rfc: 5322
dtext
+ ws
rfc: 5322
atext
rfc: 5322
Restricted-name-char subset of rfc2045 token with which IETF-tokens and IANA-tokens have to comply.
rfc: 6838 (related rfc2045)
token
Note> there are multiple mail related definitions of token, this one is the rfc2045 based one.
rfc: 2045
obs-NO-WS-CTL
rfc: 5322
combine with CText or QText to support the obsolete part of the grammar
Example
use mail_chars::{Charset, CharMatchExt, rfc5322}; fn is_ctext_with_obs(ch: char) -> bool { let res = Charset::lookup(ch); res.is(rfc5322::CTextWs) || res.is(rfc5322::ObsNoWsCtl) } assert!("\x01 comment \x02".chars().all(is_ctext_with_obs));
token
rfc: 7230
Token as defined in rfc7230 (HTTP/1.1) not directly a mail grammar, but relevant for shared utilities like e.g. anything Media Type (i.e. MIME-Type/Content-Type) related.
Methods
impl Charset
[src]
pub fn contains(&self, ch: char) -> bool
[src]
Returns true if the char
is part of this set of chars.
pub fn contains_or_non_ascii(&self, ch: char) -> bool
[src]
Returns true if the char
is part of the set of chars or not an ascii
char.
This is mainly meant to be used in combination with rfc6532 which
extends all *text
grammar parts/character sets to contain any
non-us-ascii character.
pub fn lookup(ch: char) -> LookupResult
[src]
Uses the internal lookup table to classify a char
.
Trait Implementations
impl Clone for Charset
[src]
impl Copy for Charset
[src]
impl Eq for Charset
[src]
impl Ord for Charset
[src]
fn cmp(&self, other: &Charset) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Charset> for Charset
[src]
impl PartialOrd<Charset> for Charset
[src]
fn partial_cmp(&self, other: &Charset) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Debug for Charset
[src]
impl Hash for Charset
[src]
Auto Trait Implementations
impl Send for Charset
impl Sync for Charset
impl Unpin for Charset
impl UnwindSafe for Charset
impl RefUnwindSafe for Charset
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,