VEBTree

Trait VEBTree 

Source
pub trait VEBTree:
    Copy
    + Sized
    + Default
    + Debug {
    const BITS: usize;
    const CAPACITY: usize = _;
    const MASK: usize = _;

    // Required methods
    fn clear(&mut self);
    fn is_empty(&self) -> bool;
    fn contains(&self, x: usize) -> bool;
    fn insert(&mut self, x: usize) -> bool;
    fn remove(&mut self, x: usize) -> bool;
    fn next(&self, x: usize) -> Option<usize>;
    fn prev(&self, x: usize) -> Option<usize>;
    fn first(&self) -> Option<usize>;
    fn last(&self) -> Option<usize>;

    // Provided methods
    fn new() -> Self { ... }
    fn iter(&self) -> VEBIterator<'_, Self>  { ... }
}
Expand description

Common trait for the different implementations of sets for different sizes.

Required Associated Constants§

Source

const BITS: usize

The set can hold values with BITS bits.

Provided Associated Constants§

Source

const CAPACITY: usize = _

The set can hold values in [0, CAPACITY)

Source

const MASK: usize = _

Mask for which part of usize is small enough to be held in this set.

Required Methods§

Source

fn clear(&mut self)

Clears the set, removing all elements.

Source

fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Source

fn contains(&self, x: usize) -> bool

Returns true if the set contains x.

Source

fn insert(&mut self, x: usize) -> bool

Adds x to the set.

If the set did not have x present, true is returned.

If the set did have x present, false is returned, and the entry is not updated.

Source

fn remove(&mut self, x: usize) -> bool

If the set contains x, removes it from the set. Returns whether such an element was present.

Source

fn next(&self, x: usize) -> Option<usize>

Returns the first element in the set that is greater or equal to x, if any.

Source

fn prev(&self, x: usize) -> Option<usize>

Returns the last element in the set that is smaller or equal to x, if any.

Source

fn first(&self) -> Option<usize>

Returns the first element in the set, if any. This element is always the minimum of all elements in the set.

Source

fn last(&self) -> Option<usize>

Returns the last element in the set, if any. This element is always the maximum of all elements in the set.

Provided Methods§

Source

fn new() -> Self

Makes a new, empty vEB-tree-like object.

Source

fn iter(&self) -> VEBIterator<'_, Self>

Returns an iterator over the values in the set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§