You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For high-performance scenarios where you want to avoid allocating a `Vec`, you can use the iterator API to process packets one-by-one as they're parsed:
115
+
## Iterator API
116
+
You can use the iterator API to process packets one-by-one as they're parsed instead of returning `Vec`:
Copy file name to clipboardExpand all lines: src/lib.rs
+89-2Lines changed: 89 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
//! # netflow_parser
2
2
//!
3
-
ANetflowParser library forCiscoV5,V7,V9, and IPFIX written inRust.Supports chaining of multiple versions in the same stream.
3
+
//! A Netflow Parser library for Cisco V5, V7, V9, and IPFIX written in Rust. Supports chaining of multiple versions in the same stream.
4
4
//!
5
5
//! ## Example
6
6
//!
@@ -83,7 +83,7 @@ A Netflow Parser library for Cisco V5, V7, V9, and IPFIX written in Rust. Suppor
83
83
//! let v5_parsed: Vec<NetflowPacket> = parsed.into_iter().filter(|p| p.is_v5()).collect();
84
84
//! ```
85
85
//!
86
-
//! ## Stream Processing (Iterator API)
86
+
//! ## Iterator API
87
87
//!
88
88
//! For high-performance scenarios where you want to avoid allocating a `Vec`, you can use the iterator API to process packets one-by-one as they're parsed:
89
89
//!
@@ -117,13 +117,34 @@ A Netflow Parser library for Cisco V5, V7, V9, and IPFIX written in Rust. Suppor
117
117
//! }
118
118
//! ```
119
119
//!
120
+
//! The iterator provides access to unconsumed bytes for advanced use cases:
121
+
//!
122
+
//! ```rust
123
+
//! use netflow_parser::NetflowParser;
124
+
//!
125
+
//! # let buffer = [0u8; 72];
126
+
//! let mut parser = NetflowParser::default();
127
+
//! let mut iter = parser.parse_bytes_iter(&buffer);
0 commit comments