Trait sauron_core::dom::Container
source · pub trait Container<MSG, XMSG> {
// Required methods
fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>;
fn view(&self, content: impl IntoIterator<Item = Node<XMSG>>) -> Node<MSG>;
fn append_child(&mut self, child: Node<XMSG>);
// Provided method
fn style(&self) -> String { ... }
}
Expand description
A Container have children that is set from the parent component
It can update its Mode and returns follow ups and/or effects on the next update loop.
The view in the container is set by the parent component. The container itself can not listen to events on its view
Required Methods§
sourcefn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>
fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>
update the model of this component and return follow ups and/or effects that will be executed on the next update loop.
sourcefn view(&self, content: impl IntoIterator<Item = Node<XMSG>>) -> Node<MSG>
fn view(&self, content: impl IntoIterator<Item = Node<XMSG>>) -> Node<MSG>
The container presents the children passed to it from the parent. The container can decide how to display the children components here, but the children nodes here can not trigger Msg that can update this component
sourcefn append_child(&mut self, child: Node<XMSG>)
fn append_child(&mut self, child: Node<XMSG>)
containers can append children