Macro dominator::box_fragment
source · macro_rules! box_fragment { () => { ... }; (move { $($input:tt)* }) => { ... }; ({ $($input:tt)* }) => { ... }; }
Expand description
The same as fragment!
except it returns a BoxFragment
.
A BoxFragment
can be stored in a struct
or static
:
static FOO: Lazy<BoxFragment> = Lazy::new(|| box_fragment!({ ... }));
fragment!
is zero-cost, but box_fragment!
is different: it has a performance cost,
because it must heap-allocate the fragment and do dynamic dispatch.