pub struct KeyIndex { /* private fields */ }
Expand description
KeyIndex
is used to store the keys for the ColumnFrame
The keys are stored in the order they are added - the order is preserved
The keys are stored in the Vec
and the indexes are stored in the HashMap
The indexes are used to access the data in the ColumnFrame
by the column Key
NOTE: The keys are unique - if the key is already present, it will be removed
Implementations§
Source§impl KeyIndex
impl KeyIndex
pub fn new(keys: Vec<Key>) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get_column_index(&self, key: &Key) -> Option<usize>
pub fn get_keys(&self) -> &[Key]
Sourcepub fn is_extendable(&self, other: &Self) -> Result<(), Error>
pub fn is_extendable(&self, other: &Self) -> Result<(), Error>
Validates the access to the entry by the given column Key
and row index
If the column is not found, an error is returned Error::NotFound
If indexes doesn’t match, an error is returned Error::IndexOutOfRange
pub fn get_key(&self, idx: usize) -> Option<Key>
pub fn select(&self, keys: &[Key]) -> KeyIndex
pub fn indexes(&self) -> Vec<usize>
pub fn store_key(&mut self, key: Key)
pub fn remove_key(&mut self, key: &Key) -> Option<(Key, usize)>
pub fn get_as_candidate( &self, row: ArrayView1<'_, DataValue>, ) -> HashMap<Key, DataValue>
pub fn to_vec_row(&self, candidate: HashMap<Key, DataValue>) -> Vec<DataValue>
pub fn check_order_of_indexes(&self, other: &Self) -> Result<(), Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for KeyIndex
impl<'de> Deserialize<'de> for KeyIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for KeyIndex
Auto Trait Implementations§
impl Freeze for KeyIndex
impl RefUnwindSafe for KeyIndex
impl Send for KeyIndex
impl Sync for KeyIndex
impl Unpin for KeyIndex
impl UnwindSafe for KeyIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more