Skip to main content

atomically_result

Function atomically_result 

Source
pub fn atomically_result<T, E>(f: impl FnOnce() -> Result<T, E>) -> Result<T, E>
where E: Display,
Expand description

Executes the given fallible function as an atomic operation.

On Ok the region is committed. On Err the SDK calls the host trap function, which surfaces as an uncatchable wasm trap so the failure cannot be observed by user code. The atomic region is intentionally left open so the existing replay-time fallback in mark_begin_operation deletes the partial inner side effects and re-executes the block.