Skip to main content

atomic

Macro atomic 

Source
macro_rules! atomic {
    ($pool:expr, |$tx:ident| $body:block) => { ... };
}
Expand description

Sugar over atomic that wraps the body in Box::pin(async move { … }) so callers don’t have to. Identical semantics:

rustango::atomic!(&pool, |tx| {
    insert_tx(tx, &q).await?;
    on_commit(|| spawn_email());
    Ok(())
})
.await?;