rust-streaming
                                
                                
                                
                                    rust-streaming copied to clipboard
                            
                            
                            
                        EXPERIMENTAL: Various hacks for zero-allocation stream parsing in Rust.
EXPERIMENTAL: Zero-Allocation Streaming Parsers in Rust
Here there be hacks. No APIs are stable. Code may not do what the comments claim.
Key goal:
- Build a 
StreamingIteratortype that can return references to internal state, including as I/O buffers and the output buffers of libraries likeflate2. This prevents implementingcollect, but why can't we havemap,filterandfold? 
Target applications:
- rust-csv.
 - Multicore map/reduce of Snappy-compressed records.
 - Anybody else who needs to iterate over a data stream without allocating.
 
Random useful things to read:
- Higher-kinded types and why they're important.
 - Emulating higher-kinded types with proposed associated types & lifetimes.
 - Iterating short-lived objects
 - Borrow scopes should not always be lexical (aka, "why we have one line of 
unsafe") - Borrow checker gets confused by a conditionally returned borrows (same as above, but clearer)
 - Iterator returning items by reference, lifetime issue (
Iteratorworks the way it does for reasons explained here) 
We beg for help::