Skip to main content

ParentElement

Trait ParentElement 

Source
pub trait ParentElement {
    // Required method
    fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>);

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

This is a helper trait to provide a uniform interface for constructing elements that can accept any number of any kind of child elements

Required Methods§

Source

fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)

Extend this element’s children with the given child elements.

Provided Methods§

Source

fn child(self, child: impl IntoElement) -> Self
where Self: Sized,

Add a single child element to this element.

Source

fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Self
where Self: Sized,

Add multiple child elements to this element.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§