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

#1343 in Data structures

Download history 242/week @ 2024-07-25 346/week @ 2024-08-01 159/week @ 2024-08-08 145/week @ 2024-08-15 91/week @ 2024-08-22 142/week @ 2024-08-29 277/week @ 2024-09-05 180/week @ 2024-09-12 114/week @ 2024-09-19 151/week @ 2024-09-26 153/week @ 2024-10-03 155/week @ 2024-10-10 187/week @ 2024-10-17 141/week @ 2024-10-24 126/week @ 2024-10-31 157/week @ 2024-11-07

660 downloads per month
Used in 5 crates (2 directly)

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