Struct mem_query::transaction::Transaction [−][src]
#[must_use]pub struct Transaction<'a, Root: 'a + ?Sized, Undo = (), E = Infallible> { /* fields omitted */ }
Expand description
A transaction holds exclusive access to some root object and lets you
apply RevertableOp
s to it. If any of these operations fail, the prior
ones are immediately reverted and further operation requests are ignored.
The error will be returned from commit()
.
Implementations
impl<'a, T: 'a + ?Sized> Transaction<'a, T>
[src]
impl<'a, T: 'a + ?Sized> Transaction<'a, T>
[src]impl<'a, Root: ?Sized + 'a, Undo: UndoLog<Root>, E> Transaction<'a, Root, Undo, E>
[src]
impl<'a, Root: ?Sized + 'a, Undo: UndoLog<Root>, E> Transaction<'a, Root, Undo, E>
[src]pub fn revert(self)
[src]
pub fn revert(self)
[src]Process the undo log to return the root to its original state. Discards errors.
pub fn subtransaction<SubRoot, SubUndo, AccessFn, BodyFn, SubErr>(
self,
access: AccessFn,
body: BodyFn
) -> Transaction<'a, Root, (SubUndoLog<AccessFn, SubUndo, SubRoot>, Undo), Either<SubErr, E>> where
AccessFn: Accessor<Root, Dest = SubRoot>,
SubRoot: ?Sized,
BodyFn: FnOnce(Transaction<'_, SubRoot, ()>) -> Transaction<'_, SubRoot, SubUndo, SubErr>,
SubUndo: UndoLog<SubRoot>,
[src]
pub fn subtransaction<SubRoot, SubUndo, AccessFn, BodyFn, SubErr>(
self,
access: AccessFn,
body: BodyFn
) -> Transaction<'a, Root, (SubUndoLog<AccessFn, SubUndo, SubRoot>, Undo), Either<SubErr, E>> where
AccessFn: Accessor<Root, Dest = SubRoot>,
SubRoot: ?Sized,
BodyFn: FnOnce(Transaction<'_, SubRoot, ()>) -> Transaction<'_, SubRoot, SubUndo, SubErr>,
SubUndo: UndoLog<SubRoot>,
[src]Run a transaction on an object accessible from the root
.
pub fn apply<Op: RevertableOp<Root>>(
self,
op: Op
) -> Transaction<'a, Root, (Op::Log, Undo), Either<Op::Err, E>>
[src]
pub fn apply<Op: RevertableOp<Root>>(
self,
op: Op
) -> Transaction<'a, Root, (Op::Log, Undo), Either<Op::Err, E>>
[src]Apply a RevertableOp
pub fn apply_multi<Op: RevertableOp<Root>>(
self,
ops: impl IntoIterator<Item = Op>
) -> Transaction<'a, Root, (Vec<Op::Log>, Undo), Either<Op::Err, E>>
[src]
pub fn apply_multi<Op: RevertableOp<Root>>(
self,
ops: impl IntoIterator<Item = Op>
) -> Transaction<'a, Root, (Vec<Op::Log>, Undo), Either<Op::Err, E>>
[src]Apply several instances of the same RevertableOp
.
The iterator will stop as soon as one of the operations fails.
pub fn into_undo_log(self) -> Result<Undo, E>
[src]
pub fn into_undo_log(self) -> Result<Undo, E>
[src]Allows a Transaction
to be used within the implementation of a
RevertableOp
.
Auto Trait Implementations
impl<'a, Root: ?Sized, Undo, E> RefUnwindSafe for Transaction<'a, Root, Undo, E> where
E: RefUnwindSafe,
Root: RefUnwindSafe,
Undo: RefUnwindSafe,
E: RefUnwindSafe,
Root: RefUnwindSafe,
Undo: RefUnwindSafe,
impl<'a, Root: ?Sized, Undo, E> Send for Transaction<'a, Root, Undo, E> where
E: Send,
Root: Send,
Undo: Send,
E: Send,
Root: Send,
Undo: Send,
impl<'a, Root: ?Sized, Undo, E> Sync for Transaction<'a, Root, Undo, E> where
E: Sync,
Root: Sync,
Undo: Sync,
E: Sync,
Root: Sync,
Undo: Sync,
impl<'a, Root: ?Sized, Undo, E> Unpin for Transaction<'a, Root, Undo, E> where
E: Unpin,
Undo: Unpin,
E: Unpin,
Undo: Unpin,
impl<'a, Root, Undo = (), E = Infallible> !UnwindSafe for Transaction<'a, Root, Undo, E>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> Everything for T where
T: ?Sized,
[src]
T: ?Sized,