Skip to main content

Essences

Struct Essences 

Source
pub struct Essences<'a, const N: usize, const XML_NORMALIZED: bool = false> { /* private fields */ }
Expand description

One incremental MIME grammar pass and fixed, allocation-free comparisons against known type/subtype pairs. Parameters remain syntax-checked but do not participate in this comparison. This is not full MIME-value equality.

RFC2045 §§2 and 5.1: type/subtype are case-insensitive; comments and linear whitespace separate tokens. Token fragments cannot be joined across CFWS. https://www.rfc-editor.org/rfc/rfc2045.html#section-5.1

Implementations§

Source§

impl<'a, const N: usize, const XML_NORMALIZED: bool> Essences<'a, N, XML_NORMALIZED>

Source

pub fn new(patterns: [(&'a str, &'a str); N]) -> Self

Borrows the caller’s known pairs without allocation or registration lookup. The number of pairs is a compile-time mechanism parameter.

Source

pub fn feed<W: Work>( &mut self, bytes: impl AsRef<[u8]>, work: &W, ) -> Result<bool, MemoryError>

Admits grammar and all comparison work before consuming this fragment. A refusal leaves both syntax and comparisons unchanged.

Source

pub fn complete(&self) -> bool

Whether the entire original input is a complete MIME value.

Source

pub fn matches(&self, index: usize) -> Option<bool>

Compares a known pair only if the complete original grammar succeeded. None denotes an out-of-range caller index, not a missing media type.

Auto Trait Implementations§

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> Freeze for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: Freeze, [Pattern<'a>; N]: Freeze,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> RefUnwindSafe for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: RefUnwindSafe, [Pattern<'a>; N]: RefUnwindSafe,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> Send for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: Send, [Pattern<'a>; N]: Send,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> Sync for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: Sync, [Pattern<'a>; N]: Sync,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> Unpin for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: Unpin, [Pattern<'a>; N]: Unpin,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> UnsafeUnpin for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: UnsafeUnpin, [Pattern<'a>; N]: UnsafeUnpin,

§

impl<'a, const N: usize, const XML_NORMALIZED: bool> UnwindSafe for Essences<'a, N, XML_NORMALIZED>
where Syntax<XML_NORMALIZED>: UnwindSafe, [Pattern<'a>; N]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.