Struct imap_types::core::Text
source · pub struct Text<'a>(_);
Expand description
A human-readable text string used in some server responses.
Example
S: * OK IMAP4rev1 server ready
// ^^^^^^^^^^^^^^^^^^^^^^
// |
// `Text`
ABNF definition
text = 1*TEXT-CHAR
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
Implementations§
source§impl<'a> Text<'a>
impl<'a> Text<'a>
pub fn validate(value: impl AsRef<[u8]>) -> Result<(), TextError>
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 text 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 Text<'a>
impl<'a> Arbitrary<'a> for Text<'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 Text<'a>
impl<'de, 'a> Deserialize<'de> for Text<'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 Text<'a>
impl<'a> IntoBoundedStatic for Text<'a>
source§impl<'a> PartialEq<Text<'a>> for Text<'a>
impl<'a> PartialEq<Text<'a>> for Text<'a>
source§impl<'a> ToBoundedStatic for Text<'a>
impl<'a> ToBoundedStatic for Text<'a>
impl<'a> Eq for Text<'a>
impl<'a> StructuralEq for Text<'a>
impl<'a> StructuralPartialEq for Text<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Text<'a>
impl<'a> Send for Text<'a>
impl<'a> Sync for Text<'a>
impl<'a> Unpin for Text<'a>
impl<'a> UnwindSafe for Text<'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