Function with_tx

Source
pub fn with_tx<T, E>(
    conn: &mut Connection,
    f: impl FnOnce(&mut Transaction<'_>) -> Result<T, E>,
) -> Result<T, E>
where E: From<Error>,
Expand description

Short-hand for constructing a transaction, providing it as an argument to the given function, then committing the transaction before returning.