Struct makods::jostletree::JostleTree [−][src]
pub struct JostleTree<N, T> { /* fields omitted */ }
The JostleTree can be thought of as efficiently modelling a sequence of items of variable widths. It allows operations such as
-
jumping to a position and getting whatever item is there
-
resizing items, in so doing, repositioning every one of the items after it
-
inserting and removing
Operations generally have logarithmic runtime.
Methods
impl<N, T> JostleTree<N, T> where
N: Numeric,
[src]
impl<N, T> JostleTree<N, T> where
N: Numeric,
pub fn new() -> JostleTree<N, T>
[src]
pub fn new() -> JostleTree<N, T>
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
pub fn total_span(&self) -> N
[src]
pub fn total_span(&self) -> N
returns the sum of the spans of all of the items (logarithmic runtime)
pub fn insert_at<'a>(
&'a mut self,
at_offset: N,
span: N,
v: T
) -> SlotHandle<'a, N, T>
[src]
pub fn insert_at<'a>(
&'a mut self,
at_offset: N,
span: N,
v: T
) -> SlotHandle<'a, N, T>
inserts at or before whatever is at_offset.
pub fn insert_back<'a>(&'a mut self, span: N, v: T) -> SlotHandle<'a, N, T>
[src]
pub fn insert_back<'a>(&'a mut self, span: N, v: T) -> SlotHandle<'a, N, T>
inserts at the back
pub fn insert_front<'a>(&'a mut self, span: N, v: T) -> SlotHandle<'a, N, T>
[src]
pub fn insert_front<'a>(&'a mut self, span: N, v: T) -> SlotHandle<'a, N, T>
inserts at the front
pub fn get_slot_mut<'a>(&'a mut self, o: N) -> Option<SlotHandle<'a, N, T>>
[src]
pub fn get_slot_mut<'a>(&'a mut self, o: N) -> Option<SlotHandle<'a, N, T>>
returns the bucket at the offset o
negative or out of bounds o values will get first and last thing respectively. returns None if tree is empty.
pub fn get_item(&self, o: N) -> Option<&T>
[src]
pub fn get_item(&self, o: N) -> Option<&T>
pub fn remove_at(&mut self, o: N) -> Option<T>
[src]
pub fn remove_at(&mut self, o: N) -> Option<T>
negative or out of bounds o values will hit the first and last thing respectively. returns None if tree is empty.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
negative or out of bounds o values will get first and last thing respectively. returns None if tree is empty.
ⓘImportant traits for JostleTreeIter<'a, N, T>pub fn slot_iter<'a>(&'a self) -> JostleTreeIter<'a, N, T>
[src]
pub fn slot_iter<'a>(&'a self) -> JostleTreeIter<'a, N, T>
Iterates over the buckets
Trait Implementations
impl<N: Debug, T: Debug> Debug for JostleTree<N, T>
[src]
impl<N: Debug, T: Debug> Debug for JostleTree<N, T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<N: Numeric + Display, T: Display> Display for JostleTree<N, T>
[src]
impl<N: Numeric + Display, T: Display> Display for JostleTree<N, T>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<N: Numeric + Hash, T: Hash> Hash for JostleTree<N, T>
[src]
impl<N: Numeric + Hash, T: Hash> Hash for JostleTree<N, T>
fn hash<H: Hasher>(&self, h: &mut H)
[src]
fn hash<H: Hasher>(&self, h: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<N: Numeric, T: PartialEq> PartialEq for JostleTree<N, T>
[src]
impl<N: Numeric, T: PartialEq> PartialEq for JostleTree<N, T>
fn eq(&self, other: &JostleTree<N, T>) -> bool
[src]
fn eq(&self, other: &JostleTree<N, T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &JostleTree<N, T>) -> bool
[src]
fn ne(&self, other: &JostleTree<N, T>) -> bool
This method tests for !=
.
Auto Trait Implementations
impl<N, T> !Send for JostleTree<N, T>
impl<N, T> !Send for JostleTree<N, T>
impl<N, T> !Sync for JostleTree<N, T>
impl<N, T> !Sync for JostleTree<N, T>