Struct imap_codec::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<(), QuotedError>
pub fn inner(&self) -> &str
pub fn into_inner(self) -> Cow<'a, str>
sourcepub fn unvalidated<C>(inner: C) -> Quoted<'a>where
C: Into<Cow<'a, str>>,
pub fn unvalidated<C>(inner: C) -> Quoted<'a>where C: Into<Cow<'a, str>>,
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<Quoted<'a>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Quoted<'a>, Error>
Generate an arbitrary value of
Self
from the given unstructured data. Read more§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<Quoted<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Quoted<'a>, <__D as Deserializer<'de>>::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§fn into_static(self) -> <Quoted<'a> as IntoBoundedStatic>::Static
fn into_static(self) -> <Quoted<'a> as IntoBoundedStatic>::Static
Convert an owned
T
into an owned T
such that T: 'static
.source§impl<'a> PartialEq<Quoted<'a>> for Quoted<'a>
impl<'a> PartialEq<Quoted<'a>> for Quoted<'a>
source§impl<'a> Serialize for Quoted<'a>
impl<'a> Serialize for Quoted<'a>
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
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