Skip to main content

fork

Macro fork 

Source
macro_rules! fork {
    ($req:expr, $($pred:expr => $jig:expr,)+ _ => $default:expr $(,)?) => { ... };
}
Expand description

Multi-arm fork. Predicates are checked in order; the first match consumes the request and its jig is run. If none match, the _ => default arm runs. Every arm must produce the same Out type; each arm’s internal pipeline can have its own intermediate types.

fork!(req,
    |r| r.path.starts_with("/auth/")  => auth,
    |r| r.path.starts_with("/todos")  => todos,
    |r| r.path.starts_with("/labels") => labels,
    _ => not_found,
)