simple-middleware 0.3.0

General purpose middleware crate
Documentation
use simple_middleware::Manager;

#[tokio::main]
async fn main() {
    // 1. Using the static method `last`, we can create a new manager and pass the last middleware
    //    in one step
    let manager = Manager::last(|v, _n| async move { v + 22_usize }).await;

    // 2. We can also chain calls to the `next` method
    manager
        .next(|mut v, next| async move {
            v += 4;
            next.call(v).await
        })
        .await
        .next(|v, next| async move { next.call(v * 2).await })
        .await;

    let result: usize = manager.send(200).await;

    println!("result: {result}");
}