6 releases

0.1.0 May 24, 2021
0.0.10 Jun 12, 2020
0.0.9 Aug 17, 2018
0.0.7 Jan 21, 2018
0.0.4 Oct 24, 2015

#1340 in Data structures

Download history 2/week @ 2024-02-19 4/week @ 2024-02-26 89/week @ 2024-04-01

89 downloads per month

MIT license

43KB
723 lines

Chainbuf

Build Status

Chained buffer of contigious byte chunks.

Simple usage

Plug the package into your app via Cargo:

[dependencies]
chainbuf = "0.0.4"

then use it:

extern crate chainbuf;
use chainbuf::Chain;
let mut chain = Chain::new();
chain.append_bytes("helloworld".as_bytes());
let some_bytes = chain.pullup(2);

Details of implementation

Chainbuf consists of linked list of nodes, with start and end offsets and a reference counted pointer to DataHolder. DataHolders can be shared across different chains, so for mutation new nodes and data holders are created (as in Copy-On-Write).


lib.rs:

The main crate for the Chainbuf library.

... docs are to be written

Dependencies

~1.5MB
~35K SLoC