[][src]Struct rql::TableGuardMut

pub struct TableGuardMut<'a, T> where
    T: Serialize
{ /* fields omitted */ }

A mutable guard to a Table

Methods

impl<'a, T> TableGuardMut<'a, T> where
    T: Serialize
[src]

pub fn path(&self) -> PathBuf[src]

Get the path of the table file

Methods from Deref<Target = Table<T>>

pub fn len(&self) -> usize[src]

Get the number of rows in the Table

pub fn is_empty(&self) -> bool[src]

Check if the Table` is empty

pub fn insert(&mut self, row: T) -> Id<T>[src]

Insert a row into the Table

pub fn get(&self, id: Id<T>) -> Option<&T>[src]

Try to get a reference to the row with the given Id

pub fn get_mut(&mut self, id: Id<T>) -> Option<&mut T>[src]

Try to get a mutable reference to the row with the given Id

pub fn remove(&mut self, id: Id<T>) -> Option<T>[src]

Remove the row with the given Id

Important traits for RowIter<'a, T>
pub fn rows(&self) -> RowIter<T>[src]

Iterate over all rows in the Table

Important traits for RowIterMut<'a, T>
pub fn rows_mut(&mut self) -> RowIterMut<T>[src]

Iterate mutably over all rows in the Table

pub fn delete_one(&mut self, id: Id<T>) -> Option<T>[src]

Delete a single row based on its Id and return the value

pub fn delete_where<F>(&mut self, f: F) -> usize where
    F: Fn(&T) -> bool
[src]

Delete rows that satisfy the clause

Returns how many rows where deleted

pub fn delete_iter<'a, F, I, R>(&'a mut self, f: F) where
    F: Fn(&'a Self) -> I,
    I: IntoIterator<Item = R>,
    R: Idd<RowType = T>, 
[src]

Delete rows with ids returned by an iterator

pub fn save<P>(&self, path: P, repr: Representation) -> Result<()> where
    P: AsRef<Path>, 
[src]

Save the database to a file

pub fn save_to_bytes(&self, repr: Representation) -> Result<Vec<u8>>[src]

Save the database to a byte vector

Trait Implementations

impl<'a, T> Drop for TableGuardMut<'a, T> where
    T: Serialize
[src]

impl<'a, T> DerefMut for TableGuardMut<'a, T> where
    T: Serialize
[src]

impl<'a, T: Debug> Debug for TableGuardMut<'a, T> where
    T: Serialize
[src]

impl<'a, T> Deref for TableGuardMut<'a, T> where
    T: Serialize
[src]

type Target = Table<T>

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a, T> Sync for TableGuardMut<'a, T> where
    T: Sync

impl<'a, T> !Send for TableGuardMut<'a, T>

impl<'a, T> Unpin for TableGuardMut<'a, T>

impl<'a, T> RefUnwindSafe for TableGuardMut<'a, T>

impl<'a, T> UnwindSafe for TableGuardMut<'a, T>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]