5 releases

0.1.4 Aug 14, 2022
0.1.3 Nov 14, 2020
0.1.2 Sep 5, 2018
0.1.1 Sep 2, 2018
0.1.0 Sep 1, 2018

#1438 in Data structures

Download history 256/week @ 2023-12-06 337/week @ 2023-12-13 75/week @ 2023-12-20 119/week @ 2023-12-27 418/week @ 2024-01-03 198/week @ 2024-01-10 37/week @ 2024-01-17 82/week @ 2024-01-24 188/week @ 2024-01-31 126/week @ 2024-02-07 218/week @ 2024-02-14 403/week @ 2024-02-21 197/week @ 2024-02-28 209/week @ 2024-03-06 125/week @ 2024-03-13 240/week @ 2024-03-20

881 downloads per month

MIT/Apache

45KB
1K SLoC

gapbuf-rs

Crates.io Docs.rs Actions Status

Generic gap buffer implementation in Rust.

This crate provides the type GapBuffer. This type has methods similar to Vec.

Examples

use gapbuf::gap_buffer;

let mut b = gap_buffer![1, 2, 3];
b.insert(1, 10);
assert_eq!(b, [1, 10, 2, 3]);

b.remove(2);
assert_eq!(b, [1, 10, 3]);

License

This project is dual licensed under Apache-2.0/MIT. See the two LICENSE-* files for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

gapbuf provides the type GapBuffer. GapBuffer has methods similar to Vec.

Examples

use gapbuf::gap_buffer;

let mut b = gap_buffer![1, 2, 3];

b.insert(1, 10);
assert_eq!(b, [1, 10, 2, 3]);

b.remove(2);
assert_eq!(b, [1, 10, 3]);

No runtime deps