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);
- Find the node greater than or equal to the key and return the mutable reference
- Randomly generate level
- Create new node
- Insert and set forwards
Trait Implementations
impl<R: Clone, C: Clone, A: Clone> Clone for SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<R: Clone, C: Clone, A: Clone> Clone for SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<R, C, A> Display for SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<R, C, A> Display for SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<R, C, A, T> Extend<T> for SkipList<R, C, A> where
T: Into<u8>,
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<R, C, A, T> Extend<T> for SkipList<R, C, A> where
T: Into<u8>,
R: RandomGenerator,
C: BaseComparator,
A: Arena,
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
impl<'a, R, C, A> IntoIterator for &'a SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
impl<'a, R, C, A> IntoIterator for &'a SkipList<R, C, A> where
R: RandomGenerator,
C: BaseComparator,
A: Arena,
Auto Trait Implementations
impl<R, C, A> RefUnwindSafe for SkipList<R, C, A> where
A: RefUnwindSafe,
C: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, C, A> UnwindSafe for SkipList<R, C, A> where
A: RefUnwindSafe,
C: RefUnwindSafe,
R: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more