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§
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
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.