pub struct Children<V> { /* private fields */ }
Expand description
A special property type to allow the component to accept children.
Add a field called children
of this type to your properties struct.
§Example
#[derive(Props)]
struct RowProps {
width: i32,
children: Children,
}
#[component]
fn Row(props: RowProps) -> View {
// Convert the `Children` into a `View`.
let children = props.children.call();
view! {
div {
(children)
}
}
}
// Using `Row` somewhere else in your app:
view! {
Row(width=10) {
p { "This is a child node." }
}
}
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for Children<V>
impl<V> !RefUnwindSafe for Children<V>
impl<V> !Send for Children<V>
impl<V> !Sync for Children<V>
impl<V> Unpin for Children<V>
impl<V> !UnwindSafe for Children<V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more