pub struct ImapCodec { /* private fields */ }Expand description
Tokio codec for IMAP. Switches between line mode (CRLF-terminated commands + responses) and literal mode (raw byte-counted payloads).
IMAP uses literals (e.g. {12}\r\nHello world!) for arbitrary
binary content — passwords with special chars, APPEND payloads,
FETCH BODY[…] data. The protocol layer parses the {N} marker,
then calls expect_literal to tell the
codec to read the next N bytes as raw data instead of splitting
on CRLF.
Implementations§
Source§impl ImapCodec
impl ImapCodec
Sourcepub fn expect_literal(&mut self, size: u32)
pub fn expect_literal(&mut self, size: u32)
Switch the codec into literal mode for the next decode.
size is the byte count parsed from the IMAP {N} marker.
After exactly size bytes have been read, the codec
auto-switches back to line mode (consuming any trailing
CRLF if present).
Trait Implementations§
Source§impl Decoder for ImapCodec
impl Decoder for ImapCodec
Source§fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
Auto Trait Implementations§
impl Freeze for ImapCodec
impl RefUnwindSafe for ImapCodec
impl Send for ImapCodec
impl Sync for ImapCodec
impl Unpin for ImapCodec
impl UnsafeUnpin for ImapCodec
impl UnwindSafe for ImapCodec
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