Struct server::storage::bstar::SortedList
[−]
[src]
pub struct SortedList<T: PartialOrd + Debug> { pub list: Vec<T>, pub elementcount: u64, }
Fields
list | |
elementcount |
Methods
impl<T: PartialOrd + Debug> SortedList<T>
fn new() -> SortedList<T>
generates a new SortedList
fn with_capacity(size: usize) -> SortedList<T>
allocates some memory for the new sorted list
fn empty(&self) -> bool
returns true when the list is empty
fn insert_at_index(&mut self, index: usize, key: T)
inserts a given key at a given index
fn insert(&mut self, value: T) -> u64
returns the index where the inserted value is located
fn split_by_index(&mut self, index: usize) -> SortedList<T>
Splits the SortedList into 2 based on index. After calling this function the original list will contain the data from [0, index], the returned List will contain the data from (index, elementcount)
panics if index is out of bounds
fn split_by_key(&mut self, key: &T) -> SortedList<T>
behaves as split_by_index but splits the list at the key position
fn delete_by_key(&mut self, value: &T) -> Option<T>
deletes and returns a given key
fn delete_by_index(&mut self, index: usize) -> Option<T>
deletes a key at indexposition
fn get_by_index(&mut self, index: usize) -> Option<&mut T>
returns a mutable reference to a key found at index
fn get_by_key(&mut self, tofind: &T) -> Option<&mut T>
returns a mutable reference to a key found by searching for it
fn get_index_by_key(&self, tofind: &T) -> (bool, usize)
returns the indexvalue where a key is located, or if it wasn't found where it's proper place would be: [0,1,5] <- serching for 3 will result in (false, 2)