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
An element that can hold any number of children of any type.
This is the trait behind .child() and .children() on containers such as div. Each
child is anything that implements IntoElement, so strings, views and other elements can be
mixed in one container.
Required Methods§
Sourcefn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
Adds the given children to the end of this element’s children.
Provided Methods§
Sourcefn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
Adds one child to this element, and returns the element for chaining.
Sourcefn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
Adds several children to this element, in iteration order, and returns the element.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".