Skip to main content

sync_operation

Function sync_operation 

Source
pub fn sync_operation<In: Clone + 'static, Out: Clone + 'static, Err: Clone + 'static>(
    execute_fn: impl Fn(In) -> Result<Out, Err> + 'static,
    compensate_fn: impl Fn(In, Out) -> Result<(), Err> + 'static,
) -> impl Operation<In = In, Out = Out, Err = Err>
Expand description

Constructs an Operation from two synchronous closures: one for executing the operation, and one for rolling it back. This is a convenience wrapper around operation for cases where the execute and compensate logic is synchronous.