Struct dakv_skiplist::SkipList[][src]

pub struct SkipList<R, C, A> where
    R: RandomGenerator,
    C: BaseComparator,
    A: Arena
{ /* fields omitted */ }

Implementations

Returns the number of elements in the skiplist.

Examples

use dakv_skiplist::{SkipList, Random, ArenaImpl, DefaultComparator};

let mut sl = SkipList::new(
    Random::new(0xdead_beef),
    DefaultComparator::default (),
    ArenaImpl::new(),
);
assert_eq!(sl.len(), 0);

sl.insert(vec![1u8]);
assert_eq!(sl.len(), 1);

Returns true if the skiplist is empty.

Examples

use dakv_skiplist::{SkipList, Random, ArenaImpl, DefaultComparator};

let mut sl = SkipList::new(
    Random::new(0xdead_beef),
    DefaultComparator::default (),
    ArenaImpl::new(),
);
assert!(sl.is_empty());

sl.insert(vec![1u8]);
assert_eq!(sl.is_empty(), false);

Clear every single node and reset the head node.

Examples

use dakv_skiplist::{SkipList, Random, ArenaImpl, DefaultComparator};

let mut sl = SkipList::new(
    Random::new(0xdead_beef),
    DefaultComparator::default (),
    ArenaImpl::new(),
);
sl.insert(vec![1u8]);
sl.clear();
assert_eq!(sl.is_empty(), true);

Look for the node greater than or equal to key

Safety

todo doc

  1. Find the node greater than or equal to the key and return the mutable reference
  2. Randomly generate level
  3. Create new node
  4. Insert and set forwards

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

Extends a collection with the contents of an iterator. Read more

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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)

recently added

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

Converts the given value to a String. 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.