Macro raui_core::unpack_named_slots [−][src]
macro_rules! unpack_named_slots { ($map:expr => $name:ident) => { ... }; ($map:expr => { $($name:ident),+ }) => { ... }; }
Expand description
A helper for getting the named children out of a widget context
Example
fn my_component(context: WidgetContext) -> WidgetNode { // Destructure our context to get our named slots let WidgetContext { named_slots, .. } = context; // Unpack our named `body` slot unpack_named_slots!(named_slots => body); widget! { (content_box { // insert our body slot in the content box content = {body} }) } }
You can also unpack multiple slots at a time like this:
// Unpack the `header`, `body`, and `footer` slots unpack_named_slots!(named_slots => { header, body, footer });