lunar-lib 0.9.0

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

pub trait Createable: Sized + DatabaseEntry {
    type CreateArgs: Clone;
    type Err;

    /// Creates a new [`Self`] in the database using [`Self::CreateArgs`]
    fn tx_create(
        cas_tx: &mut CompareAndSwapTransaction<Self::Db>,
        args: Self::CreateArgs,
    ) -> Result<Self, CustomTransactionError<Self::Err>>;
}