Struct hadean_std::list::Leaf [] [src]

pub struct Leaf<T> {
    // some fields omitted
}

A scalable distributed list datastructure. Provides O(1) indertion and deletion. Indexed by a LeafIndex, which can be incremented or decremented in O(1). LeafIndexs for each of the start and end of the list can be retreived in O(1).

Here's an example that let mut leaf: Box<Leaf<u8>> = box unsafe{mem::uninitialized()}; Leaf::init(&mut leaf); let mut replace_start_index = leaf.start(); let mut replace_end_index = replace_start_index.clone_right(); leaf.replace(&mut replace_start_index, &mut replace_end_index, &[1,2,3]); // http://doc.rust-lang.org/std/iter/trait.Iterator.html#method.cloned leaf.increment(&mut replace_start_index); leaf.increment(&mut replace_start_index); leaf.replace(&mut replace_start_index, &mut replace_end_index, &[4,5,6]); // http://doc.rust-lang.org/std/iter/trait.Iterator.html#method.cloned let mut start = leaf.start(); let mut end = leaf.end(); for num in leaf.read(&mut start, &mut end) { println!("{}", num); } // prints: 1 2 4 5 6

Methods

impl<T> Leaf<T>
[src]

fn init(self_: &mut Self)

fn start(&mut self) -> LeafIndex

fn end(&mut self) -> LeafIndex

fn replace<I>(&mut self, start: &mut LeafIndex, end: &mut LeafIndex, replacement: I) where I: IntoIterator<Item=T>, I::IntoIter: ExactSizeIterator, T: Copy

fn read(&mut self, start: &mut LeafIndex, end: &mut LeafIndex) -> Vec<T> where T: Copy

fn increment(&mut self, index: &mut LeafIndex)

fn decrement(&mut self, index: &mut LeafIndex)