Struct RaxSet

Source
pub struct RaxSet<K: RaxKey> { /* private fields */ }
Expand description

RaxMap but without the values. The “isnull” bit will be set for all entries. #Examples

let mut r = RaxSet::new();
r.insert(1);
r.insert(2);

r.iter(|r, iter| {
    // Place iterator at the first entry.
    if !iter.seek_min() {
        // EOF
        return
    }

    // Can test EOF at any time.
    if iter.eof() {
        // EOF
        return
    }

    while iter.forward() {
        iter.key();
    }
    // In reverse
    // Place iterator at the end.
    if !iter.end() {
        // EOF
        return
    }
    while iter.back() {
        iter.key();
    }

    // Seek
    if !iter.seek(">=", 2) {
        // EOF
    }
    while iter.forward() {
        iter.key();
    }
});

Implementations§

Source§

impl<K: RaxKey> RaxSet<K>

Source

pub fn new() -> RaxSet<K>

Source

pub fn len(&self) -> u64

The number of entries in the RAX

Source

pub fn size(&self) -> u64

The number of entries in the RAX

Source

pub fn show(&self)

Prints the Rax as ASCII art to stdout.

Source

pub fn insert(&mut self, key: K) -> Result<bool, RaxError>

Insert a new entry into the RAX replacing and returning the existing entry for the supplied key.

Source

pub fn remove(&mut self, key: K) -> bool

Source

pub fn exists(&self, key: K) -> bool

Determines if the supplied key exists in the Rax.

Source

pub fn seek_min<F>(&mut self, f: F)
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>),

Source

pub fn seek_min_result<R, F>(&mut self, f: F) -> Result<R, RaxError>
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>) -> Result<R, RaxError>,

Source

pub fn seek_max<F>(&mut self, f: F)
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>),

Source

pub fn seek_max_result<R, F>(&mut self, f: F) -> Result<R, RaxError>
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>) -> Result<R, RaxError>,

Source

pub fn seek<F>(&mut self, op: &str, key: K, f: F)
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>),

Source

pub fn seek_result<R, F>( &mut self, op: &str, key: K, f: F, ) -> Result<R, RaxError>
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>) -> Result<R, RaxError>,

Source

pub fn iter<F>(&mut self, f: F)
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>),

Source

pub fn iter_result<F, R>(&mut self, f: F) -> Result<R, RaxError>
where F: Fn(&mut RaxSet<K>, &mut RaxIterator<K, usize>) -> Result<R, RaxError>,

Trait Implementations§

Source§

impl<K: RaxKey> Drop for RaxSet<K>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<K> Freeze for RaxSet<K>

§

impl<K> RefUnwindSafe for RaxSet<K>
where K: RefUnwindSafe,

§

impl<K> !Send for RaxSet<K>

§

impl<K> !Sync for RaxSet<K>

§

impl<K> Unpin for RaxSet<K>
where K: Unpin,

§

impl<K> UnwindSafe for RaxSet<K>
where K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.