pub struct Table<'b, T>where
T: TableLayout,{ /* private fields */ }
Expand description
A table of values from an oppened database.
Implementations§
Source§impl<'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)
pub fn update<'t, K, F>(&'t self, key: &K, op: F)
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> Freeze for Table<'b, T>
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§
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