pub struct DArray { /* private fields */ }
Expand description

Constant-time select data structure over integer sets with the dense array technique by Okanohara and Sadakane.

This is a yet another Rust port of succinct::darray.

Examples

use sucds::DArray;

let da = DArray::from_bits(&[true, false, false, true]);

assert_eq!(da.select(0), 0);
assert_eq!(da.select(1), 3);

let mut bytes = vec![];
let size = da.serialize_into(&mut bytes).unwrap();
let other = DArray::deserialize_from(&bytes[..]).unwrap();
assert_eq!(da, other);
assert_eq!(size, bytes.len());
assert_eq!(size, da.size_in_bytes());

References

  • D. Okanohara, and K. Sadakane, “Practical Entropy-Compressed Rank/Select Dictionary,” In ALENEX, 2007.

Implementations

Creates a new DArray from input bitset bits.

Arguments
  • bits: List of bits.

Serializes the data structure into the writer, returning the number of serialized bytes.

Arguments
  • writer: std::io::Write variable.

Deserializes the data structure from the reader.

Arguments
  • reader: std::io::Read variable.

Returns the number of bytes to serialize the data structure.

Searches the k-th iteger.

Arguments
  • k: Select query.
Complexity
  • Constant
Examples
use sucds::DArray;

let da = DArray::from_bits(&[true, false, false, true]);
assert_eq!(da.select(0), 0);
assert_eq!(da.select(1), 3);

Gets the number of integers.

Checks if the set is empty.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.