Transaction

Trait Transaction 

Source
pub trait Transaction: Clone {
    // Provided method
    fn transaction<R>(
        &mut self,
        f: impl FnOnce(&mut Self) -> Result<R, Error>,
    ) -> Result<R, Error> { ... }
}
Expand description

Helper trait to make TokenIter transactional

Provided Methods§

Source

fn transaction<R>( &mut self, f: impl FnOnce(&mut Self) -> Result<R, Error>, ) -> Result<R, Error>

Transaction on a TokenIter, calls a FnOnce(&mut TokenIter) -> Result<T> within a transaction. When the closure succeeds, then the transaction is committed and its result is returned.

§Errors

When the closure returns an error, the transaction is rolled back and the error is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Transaction for ShadowCountedIter<'_, <TokenStream as IntoIterator>::IntoIter>

Implementors§