Uses old Rust 2015
0.0.0 |
|
---|
#3 in #hacks
1KB
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
StreamingIterator
type 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
,filter
andfold
?
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 (
Iterator
works the way it does for reasons explained here)
We beg for help::