Struct rustbreak::Transaction
[−]
[src]
pub struct Transaction<'a, T: Serialize + DeserializeOwned + Eq + Hash + 'a> { /* fields omitted */ }
A Transaction that is atomic in writes
You generate this by calling transaction
on a Database
The transaction does not get automatically applied when it is dropped, you have to run
it.
This allows for defensive programming where the values are only applied once it is run
.
Methods
impl<'a, T: Serialize + DeserializeOwned + Eq + Hash + 'a> Transaction<'a, T>
[src]
fn insert<S: Serialize, K: ?Sized>(&mut self, key: &K, obj: S) -> Result<()> where
T: Borrow<K>,
K: Hash + PartialEq + ToOwned<Owned = T>,
[src]
T: Borrow<K>,
K: Hash + PartialEq + ToOwned<Owned = T>,
Insert a given Object into the Database at that key
See Database::insert
for details
fn retrieve<S: DeserializeOwned, K: ?Sized>(&self, key: &K) -> Result<S> where
T: Borrow<K>,
K: Hash + Eq,
[src]
T: Borrow<K>,
K: Hash + Eq,
Retrieves an Object from the Database
See Database::retrieve
for details
fn run(self) -> Result<()>
[src]
Consumes the Transaction and runs it