#read-stream #io-read #stream #split #read #io #separate

yanked split_read

split std::io::Read streams by a separator

0.1.0 Sep 20, 2022

#28 in #read-stream

MIT/Apache

370KB
221 lines

split_read

See the crate's docs.


lib.rs:

Split Read streams.

Key Points

  • Can only separate by one byte.
  • Always zero-copy.

Alternatives

  • 🦀 std::io::Lines makes more sense to use if you need to allocate every line. Otherwise it's slower.
  • 🦀 slice::split convenient if you have the entire input in one slice. Faster on tiny inputs, slower on medium or large inputs (faster than std::io::Lines).
  • 📦 split_by significantly slower for separating by just one byte than any of the mentioned options, but can separate by multiple patterns of multiple bytes.

Performance comparison Performance comparison on tiny data

Dependencies