pub struct CachedParse {
pub frame_number: u64,
pub protocols: Vec<(&'static str, OwnedParseResult)>,
}Expand description
Cached parse result for a single packet.
Contains the parsed protocol data for all protocols found in the packet. Stored as Arc to enable zero-copy sharing between readers.
Fields§
§frame_number: u64Frame number this parse result belongs to
protocols: Vec<(&'static str, OwnedParseResult)>Parsed protocol results (protocol_name -> OwnedParseResult) Protocol name is always a static string from the registry.
Implementations§
Source§impl CachedParse
impl CachedParse
Sourcepub fn from_parse_results(
frame_number: u64,
results: &[(&'static str, ParseResult<'_>)],
) -> Self
pub fn from_parse_results( frame_number: u64, results: &[(&'static str, ParseResult<'_>)], ) -> Self
Create a new cached parse from the parse_packet result.
Sourcepub fn get_protocol(&self, name: &str) -> Option<&OwnedParseResult>
pub fn get_protocol(&self, name: &str) -> Option<&OwnedParseResult>
Get the first parse result for a specific protocol.
Note: For tunneled packets, the same protocol may appear multiple times
at different encapsulation depths. Use get_all_protocols() to get all
occurrences.
Sourcepub fn get_all_protocols<'a>(
&'a self,
name: &'a str,
) -> impl Iterator<Item = &'a OwnedParseResult> + 'a
pub fn get_all_protocols<'a>( &'a self, name: &'a str, ) -> impl Iterator<Item = &'a OwnedParseResult> + 'a
Get ALL parse results for a specific protocol.
For tunneled packets, the same protocol (e.g., IPv4) may appear at multiple encapsulation depths. This method returns all occurrences.
Sourcepub fn count_protocol(&self, name: &str) -> usize
pub fn count_protocol(&self, name: &str) -> usize
Count how many times a protocol appears in the packet.
Returns 0 if the protocol is not present.
Sourcepub fn has_protocol(&self, name: &str) -> bool
pub fn has_protocol(&self, name: &str) -> bool
Check if a specific protocol is present in the cached results.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&'static str, &OwnedParseResult)>
pub fn iter(&self) -> impl Iterator<Item = (&'static str, &OwnedParseResult)>
Iterate over all protocol results.
Trait Implementations§
Source§impl Clone for CachedParse
impl Clone for CachedParse
Source§fn clone(&self) -> CachedParse
fn clone(&self) -> CachedParse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more