cseq

Crates.iocseq
lib.rscseq
version0.1.3
sourcesrc
created_at2023-12-26 12:35:30.809567
updated_at2024-10-02 08:38:11.82202
descriptionThe library of compact sequences.
homepage
repositoryhttps://github.com/beling/bsuccinct-rs
max_upload_size
id1080879
size60,663
Piotr Beling (beling)

documentation

https://docs.rs/cseq

README

cseq is the Rust library (by Piotr Beling) of compact sequences.

Example

use cseq::elias_fano;

let ef = elias_fano::Sequence::with_items_from_slice(&[0u64, 1, 801, 920, 999]);
assert_eq!(ef.get(2), Some(801));   // get value at index
assert_eq!(ef.get(5), None);
assert_eq!(ef.iter().collect::<Vec<_>>(), [0, 1, 801, 920, 999]);
assert_eq!(ef.iter().rev().collect::<Vec<_>>(), [999, 920, 801, 1, 0]);
assert_eq!(ef.geq_cursor(801).collect::<Vec<_>>(), [801, 920, 999]);
assert_eq!(ef.geq_cursor(802).collect::<Vec<_>>(), [920, 999]);
let mut c = ef.cursor_of(801).unwrap(); // find the item by value
assert_eq!(c.index(), 2);
assert_eq!(c.value(), Some(801));
c.advance();                    // and its successors:
assert_eq!(c.index(), 3);
assert_eq!(c.value(), Some(920));   
c.advance();
assert_eq!(c.index(), 4);
assert_eq!(c.value(), Some(999));
c.advance();
assert_eq!(c.index(), 5);
assert_eq!(c.value(), None);

Benchmarks

The performance of some of the structures included in cseq can be tested with the cseq_benchmark crate.

Commit count: 673

cargo fmt