pub struct ImapLayer {
pub index: LayerIndex,
}Expand description
A zero-copy view into an IMAP layer within a packet buffer.
Fields§
§index: LayerIndexImplementations§
Source§impl ImapLayer
impl ImapLayer
pub fn new(index: LayerIndex) -> Self
pub fn at_start(len: usize) -> Self
Sourcepub fn is_untagged(&self, buf: &[u8]) -> bool
pub fn is_untagged(&self, buf: &[u8]) -> bool
Returns true if this is an untagged server response (starts with “* “).
Sourcepub fn is_continuation(&self, buf: &[u8]) -> bool
pub fn is_continuation(&self, buf: &[u8]) -> bool
Returns true if this is a continuation request (starts with “+ “).
Sourcepub fn is_tagged_response(&self, buf: &[u8]) -> bool
pub fn is_tagged_response(&self, buf: &[u8]) -> bool
Returns true if this is a tagged server response.
Sourcepub fn is_client_command(&self, buf: &[u8]) -> bool
pub fn is_client_command(&self, buf: &[u8]) -> bool
Returns true if this is a client command.
Sourcepub fn tag(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn tag(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the tag from a tagged command or response.
Returns “*” for untagged, “+” for continuation.
§Errors
Returns FieldError::InvalidValue if the payload is not valid UTF-8.
Sourcepub fn command(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn command(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the command verb for a client command.
§Errors
Returns FieldError::InvalidValue if the IMAP line cannot be parsed.
Sourcepub fn args(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn args(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the arguments / data portion of the line.
§Errors
Returns FieldError::InvalidValue if the payload is not valid UTF-8.
Sourcepub fn status(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn status(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the status from a tagged or untagged server response (OK/NO/BAD/BYE/PREAUTH).
§Errors
Returns FieldError::InvalidValue if the command verb is not a known status keyword.
Sourcepub fn text(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn text(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the text body of a server response (after the status code).
§Errors
Returns FieldError::InvalidValue if the payload is not valid UTF-8.
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Trait Implementations§
Source§impl Layer for ImapLayer
impl Layer for ImapLayer
Source§fn header_len(&self, buf: &[u8]) -> usize
fn header_len(&self, buf: &[u8]) -> usize
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Source§impl LayerDispatch for ImapLayer
impl LayerDispatch for ImapLayer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Source§fn dispatch_get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
fn dispatch_get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Source§fn dispatch_set_field(
&self,
_buf: &mut [u8],
_name: &str,
_value: FieldValue,
) -> Option<Result<(), FieldError>>
fn dispatch_set_field( &self, _buf: &mut [u8], _name: &str, _value: FieldValue, ) -> Option<Result<(), FieldError>>
Auto Trait Implementations§
impl Freeze for ImapLayer
impl RefUnwindSafe for ImapLayer
impl Send for ImapLayer
impl Sync for ImapLayer
impl Unpin for ImapLayer
impl UnsafeUnpin for ImapLayer
impl UnwindSafe for ImapLayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more