Struct imap_types::core::Atom
source · pub struct Atom<'a>(_);
Expand description
A string subset to model IMAP’s atom
s.
Rules:
- Length must be >= 1
- Only some characters are allowed, e.g., no whitespace
ABNF definition
atom = 1*ATOM-CHAR
ATOM-CHAR = <any CHAR except atom-specials>
CHAR = %x01-7F
; any 7-bit US-ASCII character, excluding NUL
atom-specials = "(" / ")" / "{" / SP / CTL / list-wildcards / quoted-specials / resp-specials
SP = %x20
CTL = %x00-1F / %x7F
; controls
list-wildcards = "%" / "*"
quoted-specials = DQUOTE / "\"
DQUOTE = %x22
; " (Double Quote)
resp-specials = "]"
Implementations§
source§impl<'a> Atom<'a>
impl<'a> Atom<'a>
sourcepub fn validate(value: impl AsRef<[u8]>) -> Result<(), ValidationError>
pub fn validate(value: impl AsRef<[u8]>) -> Result<(), ValidationError>
Validates if value conforms to atom’s ABNF definition.
sourcepub fn into_inner(self) -> Cow<'a, str>
pub fn into_inner(self) -> Cow<'a, str>
Consumes the atom, returning the inner value.
sourcepub fn unvalidated<C>(inner: C) -> Selfwhere
C: Into<Cow<'a, str>>,
Available on crate feature unvalidated
only.
pub fn unvalidated<C>(inner: C) -> Selfwhere C: Into<Cow<'a, str>>,
unvalidated
only.Constructs an atom without validation.
Warning: IMAP conformance
The caller must ensure that inner
is valid according to Self::validate
. Failing to do
so may create invalid/unparsable IMAP messages, or even produce unintended protocol flows.
Do not call this constructor with untrusted data.
Trait Implementations§
source§impl<'a> Arbitrary<'a> for Atom<'a>
impl<'a> Arbitrary<'a> for Atom<'a>
source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl<'de, 'a> Deserialize<'de> for Atom<'a>
impl<'de, 'a> Deserialize<'de> for Atom<'a>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> From<Atom<'a>> for AuthMechanism<'a>
impl<'a> From<Atom<'a>> for AuthMechanism<'a>
source§impl<'a> From<Atom<'a>> for Capability<'a>
impl<'a> From<Atom<'a>> for Capability<'a>
source§impl<'a> From<Atom<'a>> for CapabilityEnable<'a>
impl<'a> From<Atom<'a>> for CapabilityEnable<'a>
source§impl<'a> From<Atom<'a>> for FlagNameAttribute<'a>
impl<'a> From<Atom<'a>> for FlagNameAttribute<'a>
source§impl<'a> IntoBoundedStatic for Atom<'a>
impl<'a> IntoBoundedStatic for Atom<'a>
source§impl<'a> Ord for Atom<'a>
impl<'a> Ord for Atom<'a>
source§impl<'a> PartialEq<Atom<'a>> for Atom<'a>
impl<'a> PartialEq<Atom<'a>> for Atom<'a>
source§impl<'a> PartialOrd<Atom<'a>> for Atom<'a>
impl<'a> PartialOrd<Atom<'a>> for Atom<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> ToBoundedStatic for Atom<'a>
impl<'a> ToBoundedStatic for Atom<'a>
source§impl<'a> TryFrom<Atom<'a>> for CompressionAlgorithm
impl<'a> TryFrom<Atom<'a>> for CompressionAlgorithm
impl<'a> Eq for Atom<'a>
impl<'a> StructuralEq for Atom<'a>
impl<'a> StructuralPartialEq for Atom<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Atom<'a>
impl<'a> Send for Atom<'a>
impl<'a> Sync for Atom<'a>
impl<'a> Unpin for Atom<'a>
impl<'a> UnwindSafe for Atom<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more