pub struct Pop3Layer {
pub index: LayerIndex,
}Expand description
A zero-copy view into a POP3 layer within a packet buffer.
Fields§
§index: LayerIndexImplementations§
Source§impl Pop3Layer
impl Pop3Layer
pub fn new(index: LayerIndex) -> Self
pub fn at_start(len: usize) -> Self
Sourcepub fn is_response(&self, buf: &[u8]) -> bool
pub fn is_response(&self, buf: &[u8]) -> bool
Returns true if this is a server response (starts with +OK or -ERR).
Sourcepub fn is_err_response(&self, buf: &[u8]) -> bool
pub fn is_err_response(&self, buf: &[u8]) -> bool
Returns true if this is a negative response (-ERR).
Sourcepub fn response_text(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn response_text(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the response text after +OK or -ERR (trimmed).
§Errors
Returns FieldError::InvalidValue if the payload is not valid UTF-8 or
does not begin with +OK or -ERR.
Sourcepub fn command(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn command(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the command verb (for client commands).
§Errors
Returns FieldError::InvalidValue if the payload is not valid UTF-8.
Sourcepub fn args(&self, buf: &[u8]) -> Result<String, FieldError>
pub fn args(&self, buf: &[u8]) -> Result<String, FieldError>
Returns the command arguments.
§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 Pop3Layer
impl Layer for Pop3Layer
Source§fn header_len(&self, buf: &[u8]) -> usize
fn header_len(&self, buf: &[u8]) -> usize
Get the header length for this layer
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Get the list of field names for this layer
Auto Trait Implementations§
impl Freeze for Pop3Layer
impl RefUnwindSafe for Pop3Layer
impl Send for Pop3Layer
impl Sync for Pop3Layer
impl Unpin for Pop3Layer
impl UnsafeUnpin for Pop3Layer
impl UnwindSafe for Pop3Layer
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