2 个不稳定版本

0.2.0 2020年1月8日
0.1.0 2020年1月6日

#32 in #streaming-parser

MIT 许可证

12KB
164 代码行,不包括注释

Noodle

当您需要解析不完整的 I/O 流时,其中不是所有字节都同时可用(读取大文件、网络流、其他 I/O 字节流)。

此库主要与 nom::bytes::streaming 解析器函数并行工作。

您可以做什么

  • ReadMuncher: 从 Read 对象中连续抓取字节,并遍历字节包/包裹。

未来计划

  • 支持 AsyncReadStream
  • 使它泛化到任何实现 IntoIterator<u8> 的类型。
  • 通过解析 InputTake 而不是仅仅解析 &[u8](包括 str)来使其与 nom v5.0 更好地协作。

lib.rs:

提供字节流解析工具。


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
}

依赖关系

~130KB