Struct imap_types::core::Tag
source · pub struct Tag<'a>(_);
Expand description
A short alphanumeric identifier.
Each client command is prefixed with an identifier (typically, e.g., A0001, A0002, etc.) called a “tag”.
ABNF definition
tag = 1*<any ASTRING-CHAR except "+">
ASTRING-CHAR = ATOM-CHAR / resp-specials
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> Tag<'a>
impl<'a> Tag<'a>
pub fn validate(value: impl AsRef<[u8]>) -> Result<(), TagError>
pub fn inner(&self) -> &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 tag 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 Tag<'a>
impl<'a> Arbitrary<'a> for Tag<'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 Tag<'a>
impl<'de, 'a> Deserialize<'de> for Tag<'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 Tag<'a>
impl<'a> IntoBoundedStatic for Tag<'a>
source§impl<'a> PartialEq<Tag<'a>> for Tag<'a>
impl<'a> PartialEq<Tag<'a>> for Tag<'a>
source§impl<'a> ToBoundedStatic for Tag<'a>
impl<'a> ToBoundedStatic for Tag<'a>
impl<'a> Eq for Tag<'a>
impl<'a> StructuralEq for Tag<'a>
impl<'a> StructuralPartialEq for Tag<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Tag<'a>
impl<'a> Send for Tag<'a>
impl<'a> Sync for Tag<'a>
impl<'a> Unpin for Tag<'a>
impl<'a> UnwindSafe for Tag<'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