transaction 0.2.1

transaction abstraction library (a.k.a. transaction monad)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::prelude::*;

/// bind for Transaction>, equivalent to `tx.and_then(f)
pub fn bind<Tx, F, B>(tx: Tx, f: F) -> ::AndThen<Tx, F, B>
where
    B: Transaction<Ctx = Tx::Ctx, Err = Tx::Err>,
    F: Fn(Tx::Item) -> B,
    Tx: Transaction + Sized,
{
    tx.and_then(f)
}

/// return for Transaction<Ctx = Ctx, Item = T, Err = E>, equivalent to `ok(x)`
pub fn ret<Ctx, T, E>(x: T) -> ::TxOk<Ctx, T, E> {
    ok(x)
}