pub struct ParseResult {
pub packets: Vec<NetflowPacket>,
pub error: Option<NetflowError>,
}Expand description
Result of parsing NetFlow packets from a byte buffer.
This struct contains both successfully parsed packets and an optional error that stopped parsing. This ensures no data loss when parsing fails partway through a buffer.
§Examples
use netflow_parser::NetflowParser;
let mut parser = NetflowParser::default();
let buffer = vec![/* netflow data */];
let result = parser.parse_bytes(&buffer);
// Process all successfully parsed packets
for packet in result.packets {
println!("Parsed packet");
}
// Check if parsing stopped due to error
if let Some(error) = result.error {
eprintln!("Parsing stopped: {}", error);
}Fields§
§packets: Vec<NetflowPacket>Successfully parsed NetFlow packets. This vec contains all packets that were successfully parsed before any error occurred.
error: Option<NetflowError>Optional error that stopped parsing.
Nonemeans all data was successfully parsedSome(error)means parsing stopped due to an error, butpacketscontains all successfully parsed packets up to that point
Implementations§
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParseResult
impl Debug for ParseResult
Auto Trait Implementations§
impl Freeze for ParseResult
impl RefUnwindSafe for ParseResult
impl Send for ParseResult
impl Sync for ParseResult
impl Unpin for ParseResult
impl UnwindSafe for ParseResult
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