Crates.io | rbtree-defrag-buffer |
lib.rs | rbtree-defrag-buffer |
version | 0.1.0 |
source | src |
created_at | 2023-09-21 05:59:09.968362 |
updated_at | 2023-09-21 05:59:09.968362 |
description | Red-black tree based defragmentation buffer that maintains inserted and free intervals. |
homepage | https://github.com/jerry73204/rbtree-defrag-buffer |
repository | https://github.com/jerry73204/rbtree-defrag-buffer.git |
max_upload_size | |
id | 979133 |
size | 19,292 |
The implemented defragmentation buffer maintains inserted and free intervals. It supports fast interval insertion down to hundreds of nanoseconds.
The example code creates a defrag buffer for a 10-byte interval. It inserts the range 2..7, and the buffers gives two free intervals, one is 0..2 and the other is 7..10.
use rbtree_defrag_buffer::DefragBuf;
let mut buf = DefragBuf::new(10);
buf.insert(2..7).unwrap();
let free_invs: Vec<_> = buf.free_intervals().collect();
assert_eq!(free_invs, vec![0..2, 7..10]);
This software is distributed under MIT license. Please check the LICENSE.txt file to see the full license.