ChildrenExt

Trait ChildrenExt 

Source
pub trait ChildrenExt: Sized {
    // Required method
    fn get_children(&mut self) -> &mut Vec<Element>;

    // Provided methods
    fn children(self, children: impl IntoIterator<Item = Element>) -> Self { ... }
    fn maybe_child<C>(self, child: Option<C>) -> Self
       where C: IntoElement { ... }
    fn child<C>(self, child: C) -> Self
       where C: IntoElement { ... }
}
Expand description

Trait for composing child elements.

Required Methods§

Source

fn get_children(&mut self) -> &mut Vec<Element>

Returns a mutable reference to the internal children vector.

§Example
impl ChildrenExt for MyElement {
    fn get_children(&mut self) -> &mut Vec<Element> {
        &mut self.elements
    }
}

Provided Methods§

Source

fn children(self, children: impl IntoIterator<Item = Element>) -> Self

Extends the children with an iterable of Elements.

§Example
rect().children(["Hello", "World"].map(|t| label().text(t).into_element()))
Source

fn maybe_child<C>(self, child: Option<C>) -> Self
where C: IntoElement,

Appends a child only when the Option is Some.

§Example
rect().maybe_child(show_badge.then(|| label().text("New")))
Source

fn child<C>(self, child: C) -> Self
where C: IntoElement,

Appends a single child element.

§Example
rect().child(label().text("Hello"))

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ChildrenExt for Accordion

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Button

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Canvas

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Card

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Chip

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for CursorArea

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Draggable

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for DraggableCanvas

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for ResizableDraggable

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for FloatingTab

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for ImageViewer

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Menu

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for MenuButton

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for MenuContainer

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for MenuItem

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for SubMenu

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for NativeRouter

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for OverflowedContent

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Popup

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for PopupButtons

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for PopupContent

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for ResizablePanel

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for ScrollView

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for ButtonSegment

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for SegmentedButton

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Select

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for SideBarItem

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Table

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for TableBody

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for TableCell

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for TableHead

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for TableRow

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for Tile

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl ChildrenExt for TooltipContainer

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Source§

impl<T> ChildrenExt for Portal<T>

Source§

fn get_children(&mut self) -> &mut Vec<Element>

Implementors§