Macro dim_utils::balanced_or_tree
source · macro_rules! balanced_or_tree {
($x:expr $(,)?) => { ... };
($($x:expr),+ $(,)?) => { ... };
(@internal $($left:expr),*; $head:expr, $($tail:expr),+; $a:expr $(,$b:expr)?) => { ... };
(@internal $($left:expr),*; $head:expr, $($tail:expr),+; $a:expr, $b:expr, $($more:expr),+) => { ... };
}
Expand description
Source: https://github.com/seanmonstar/warp/issues/619
Takes a list of handler expressions and or
s them together
in a balanced tree. That is, instead of a.or(b).or(c).or(d)
,
it produces (a.or(b)).or(c.or(d))
, thus nesting the types
less deeply, which provides improvements in compile time.
It also applies ::warp::Filter::boxed
to each handler expression
when in debug_assertions
mode, improving compile time further.