Struct imap_codec::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) -> Text<'a>where
C: Into<Cow<'a, str>>,
pub fn unvalidated<C>(inner: C) -> Text<'a>where C: Into<Cow<'a, str>>,
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<Text<'a>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Text<'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 Text<'a>
impl<'de, 'a> Deserialize<'de> for Text<'a>
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Text<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Text<'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 Text<'a>
impl<'a> IntoBoundedStatic for Text<'a>
source§fn into_static(self) -> <Text<'a> as IntoBoundedStatic>::Static
fn into_static(self) -> <Text<'a> as IntoBoundedStatic>::Static
Convert an owned
T
into an owned T
such that T: 'static
.source§impl<'a> PartialEq<Text<'a>> for Text<'a>
impl<'a> PartialEq<Text<'a>> for Text<'a>
source§impl<'a> Serialize for Text<'a>
impl<'a> Serialize for Text<'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 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