pub trait Operation: Clone {
type In: Clone;
type Out: Clone;
type Err: Clone;
// Required methods
fn execute(&self, input: Self::In) -> Result<Self::Out, Self::Err>;
fn compensate(
&self,
input: Self::In,
result: Self::Out,
) -> Result<(), Self::Err>;
}
Expand description
Represents an atomic operation of the transaction which has a rollback action.
Implement this trait and use it within a transaction
block.
Operations can also be constructed from closures using operation
.
Required Associated Types§
Required Methods§
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.