Trait TUnitOfWork

Source
pub trait TUnitOfWork: Send + Sync {
    // Required methods
    fn begin(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send;
    fn _commit(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send;
    fn rollback(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send;
    fn close(&mut self) -> impl Future<Output = ()> + Send;

    // Provided methods
    fn commit(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send { ... }
    fn process_internal_events(
        &mut self,
    ) -> impl Future<Output = Result<(), BaseError>> + Send { ... }
    fn process_external_events(
        &mut self,
    ) -> impl Future<Output = Result<(), BaseError>> + Send { ... }
}
Expand description

Template for Unit of Work Concrete implementation must implement _commit method If you want to add hooks on events, you can implement process_internal_events and process_external_events

Required Methods§

Source

fn begin(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send

Source

fn _commit(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send

Source

fn rollback(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send

Source

fn close(&mut self) -> impl Future<Output = ()> + Send

Provided Methods§

Source

fn commit(&mut self) -> impl Future<Output = Result<(), BaseError>> + Send

Source

fn process_internal_events( &mut self, ) -> impl Future<Output = Result<(), BaseError>> + Send

Source

fn process_external_events( &mut self, ) -> impl Future<Output = Result<(), BaseError>> + Send

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.

Implementors§