pub struct Table<'b, T> where
T: TableLayout, { /* private fields */ }
Expand description
A table of values from an oppened database.
Implementations
sourceimpl<'b, T> Table<'b, T> where
T: TableLayout,
impl<'b, T> Table<'b, T> where
T: TableLayout,
sourcepub fn get<'t, K>(&'t self, key: &K) -> Option<T> where
K: TableKey<'t, T>,
pub fn get<'t, K>(&'t self, key: &K) -> Option<T> where
K: TableKey<'t, T>,
Gets an item from the table if it exists.
sourcepub fn push(&self, element: T) -> KeyRef<'_, '_, T>
pub fn push(&self, element: T) -> KeyRef<'_, '_, T>
pushes a new value at the end of the table.
sourcepub fn set<'t, K>(&'t self, key: &K, value: T) where
K: TableKey<'t, T>,
pub fn set<'t, K>(&'t self, key: &K, value: T) where
K: TableKey<'t, T>,
Sets an entry of the table to a certain value.
pub fn delete<'t, K>(&'t self, key: &K) where
K: TableKey<'t, T>,
sourcepub fn update<'t, K, F>(&'t self, key: &K, op: F) where
K: TableKey<'t, T>,
F: FnOnce(&mut Option<T>),
pub fn update<'t, K, F>(&'t self, key: &K, op: F) where
K: TableKey<'t, T>,
F: FnOnce(&mut Option<T>),
updates an entry. If it did not existed but Some(_) is set by the closure, then it is stored. If it existed but None is set by the closure, then it is deleted.
pub fn keys<'t>(&'t self) -> impl Iterator<Item = KeyRef<'t, 'b, T>>
pub fn iter<'t>(&'t self) -> impl Iterator<Item = (KeyRef<'t, 'b, T>, T)>
Trait Implementations
Auto Trait Implementations
impl<'b, T> !RefUnwindSafe for Table<'b, T>
impl<'b, T> Send for Table<'b, T>
impl<'b, T> Sync for Table<'b, T>
impl<'b, T> Unpin for Table<'b, T>
impl<'b, T> !UnwindSafe for Table<'b, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more