Skip to main content

LayerDispatch

Trait LayerDispatch 

Source
pub trait LayerDispatch {
    // Required methods
    fn dispatch_kind(&self) -> LayerKind;
    fn dispatch_index(&self) -> &LayerIndex;
    fn dispatch_summary(&self, buf: &[u8]) -> String;
    fn dispatch_header_len(&self, buf: &[u8]) -> usize;
    fn dispatch_field_names(&self) -> &'static [&'static str];
    fn dispatch_get_field(
        &self,
        buf: &[u8],
        name: &str,
    ) -> Option<Result<FieldValue, FieldError>>;
    fn dispatch_set_field(
        &self,
        buf: &mut [u8],
        name: &str,
        value: FieldValue,
    ) -> Option<Result<(), FieldError>>;
    fn dispatch_show_fields(&self, buf: &[u8]) -> Vec<(&'static str, String)>;

    // Provided method
    fn dispatch_hashret(&self, _buf: &[u8]) -> Vec<u8>  { ... }
}
Expand description

Auto-dispatched trait for LayerEnum.

Generated by enum_dispatch to eliminate manual match-arm boilerplate and enable the compiler to inline dispatch calls more aggressively.

Required Methods§

Source

fn dispatch_kind(&self) -> LayerKind

Get the kind of this layer.

Source

fn dispatch_index(&self) -> &LayerIndex

Get the layer index (start/end offsets).

Source

fn dispatch_summary(&self, buf: &[u8]) -> String

Get a human-readable summary.

Source

fn dispatch_header_len(&self, buf: &[u8]) -> usize

Get the header length in bytes.

Source

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>>

Get a field value by name.

Source

fn dispatch_set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>

Set a field value by name.

Source

fn dispatch_show_fields(&self, buf: &[u8]) -> Vec<(&'static str, String)>

Get show-fields output.

Provided Methods§

Source

fn dispatch_hashret(&self, _buf: &[u8]) -> Vec<u8>

Compute a hash for packet matching.

Implementors§