Skip to main content

compose_components

Macro compose_components 

Source
macro_rules! compose_components {
    ($c1:ident,$c2:ident) => { ... };
    ($c1:ident,$c2:ident,$c3:ident,$c4:ident,$c5:ident,$c6:ident,$c7:ident,$c8:ident,$c9:ident,$($c10:ident),+) => { ... };
    ($c1:ident,$c2:ident,$c3:ident,$c4:ident,$c5:ident,$($c6:ident),+) => { ... };
    ($c1:ident,$c2:ident,$c3:ident,$($c4:ident),+) => { ... };
    ($c1:ident,$c2:ident,$($c3:ident),+) => { ... };
}
Expand description

For a list of components ComponentA, ComponentB, ComponentC constructs a type ComposedComponent<ComponentA, ComposedComponent<ComponentB, ComponentC>>.

As an optimization we match subtrees up to a certain depth and build up a tree like ((c,c),(c,c)) instead of (c, (c, (c, c))). This about halves the recursion depth for each level of additional matching we do.