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.