Struct imap_types::core::Quoted
source · pub struct Quoted<'a>(_);
Expand description
A quoted string.
“The quoted string form is an alternative that avoids the overhead of processing a literal at the cost of limitations of characters which may be used.
A quoted string is a sequence of zero or more 7-bit characters, excluding CR and LF, with double quote (<“>) characters at each end.” (RFC 3501)
ABNF definition
quoted = DQUOTE *QUOTED-CHAR DQUOTE
DQUOTE = %x22
; " (Double Quote)
QUOTED-CHAR = <any TEXT-CHAR except quoted-specials> / "\" quoted-specials
TEXT-CHAR = <any CHAR except CR and LF>
CHAR = %x01-7F
; any 7-bit US-ASCII character, excluding NUL
CR = %x0D
; carriage return
LF = %x0A
; linefeed
quoted-specials = DQUOTE / "\"
Implementations§
source§impl<'a> Quoted<'a>
impl<'a> Quoted<'a>
pub fn validate(value: impl AsRef<[u8]>) -> Result<(), ValidationError>
pub fn inner(&self) -> &str
pub fn into_inner(self) -> Cow<'a, str>
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 a quoted string 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 Quoted<'a>
impl<'a> Arbitrary<'a> for Quoted<'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 Quoted<'a>
impl<'de, 'a> Deserialize<'de> for Quoted<'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> IntoBoundedStatic for Quoted<'a>
impl<'a> IntoBoundedStatic for Quoted<'a>
source§impl<'a> PartialEq<Quoted<'a>> for Quoted<'a>
impl<'a> PartialEq<Quoted<'a>> for Quoted<'a>
source§impl<'a> ToBoundedStatic for Quoted<'a>
impl<'a> ToBoundedStatic for Quoted<'a>
impl<'a> Eq for Quoted<'a>
impl<'a> StructuralEq for Quoted<'a>
impl<'a> StructuralPartialEq for Quoted<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Quoted<'a>
impl<'a> Send for Quoted<'a>
impl<'a> Sync for Quoted<'a>
impl<'a> Unpin for Quoted<'a>
impl<'a> UnwindSafe for Quoted<'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