lunar-lib 0.9.0

Common utilities for lunar applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::database::{CompareAndSwapTransaction, DatabaseEntry, TransactionError};

pub trait Deleteable: Sized + DatabaseEntry {
    /// Deletes an entry from the database
    ///
    /// This function should be safe way to delete entries from the database, unlinking references and removing `self` from the database, if exists
    fn tx_delete(
        self,
        cas_tx: &mut CompareAndSwapTransaction<Self::Db>,
    ) -> Result<(), TransactionError> {
        cas_tx.tx_remove(self.id())
    }
}