pub struct Syntax<const XML_NORMALIZED: bool = false> { /* private fields */ }Expand description
Incremental allocation-free RFC2045 media-type syntax.
The default consumes original MIME octets and requires CRLF folding.
XML_NORMALIZED = true additionally accepts XML’s already normalized LF.
This does not resolve registered media types or compare their semantics.
use std::sync::Arc;
use structured_asn1::memory::{Memory, MemoryAccount};
use structured_cms::mime::Syntax;
let work = Memory::new(Arc::new(MemoryAccount::new(0, 1000)));
let mut value = Syntax::<false>::new();
assert!(value.feed("text/plain; charset=", &work).unwrap());
assert!(!value.complete());
assert!(value.feed("utf-8", &work).unwrap());
assert!(value.complete());Implementations§
Source§impl<const XML_NORMALIZED: bool> Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> Syntax<XML_NORMALIZED>
Sourcepub fn feed<W: Work>(
&mut self,
value: impl AsRef<[u8]>,
execution: &W,
) -> Result<bool, MemoryError>
pub fn feed<W: Work>( &mut self, value: impl AsRef<[u8]>, execution: &W, ) -> Result<bool, MemoryError>
Admits the whole fragment before changing state, then consumes it. Syntax failure is sticky across subsequent fragments. Resource failure leaves the state unchanged. Input may be borrowed str or byte slices.
Trait Implementations§
Auto Trait Implementations§
impl<const XML_NORMALIZED: bool> Freeze for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> RefUnwindSafe for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> Send for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> Sync for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> Unpin for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> UnsafeUnpin for Syntax<XML_NORMALIZED>
impl<const XML_NORMALIZED: bool> UnwindSafe for Syntax<XML_NORMALIZED>
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