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
Source§impl LayerDispatch for Pop3Layer
impl LayerDispatch for Pop3Layer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Get the kind of this layer.
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Get the layer index (start/end offsets).
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Get a human-readable summary.
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Get the header length in bytes.
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Get field names for this layer type.
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>>
Get a field value by name.
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>>
Set a field value by name.
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
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>
Converts
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>
Converts
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