2 unstable releases
0.2.0 | Jan 8, 2020 |
---|---|
0.1.0 | Jan 6, 2020 |
#32 in #streaming-parser
12KB
164 lines
Noodle
For when you need to parse incomplete I/O streams, where not all bytes are available at once (reading huge files, network streams, other I/O byte streams).
This is mainly meant to work side-by-side with nom::bytes::streaming
parser functions.
What You Can Do
ReadMuncher
: Continuously grab bytes fromRead
objects, and iterate over byte packets/parcels.
Future Plans
- Support
AsyncRead
andStream
. - Make generic over anything implementing
IntoIterator<u8>
. - Make it work better with nom v5.0, by parsing
InputTake
instead of just&[u8]
(str
included).
lib.rs
:
Provides byte stream parsing utilities.
let reader = File::open("..."); // reader is anything that implements io::Read
let alloc_size = 1000; // Set custom allocation size
let muncher = ReadMuncher::<DataItem, _>::new(&reader, alloc_size, |bytes, is_eof| {
// parse function here
});
for packet in &muncher {
// packet is DataItem
}
Dependencies
~135KB