pub trait ItemTreeBuilder {
type SubComponentState: Clone;
fn push_repeated_item(
&mut self,
item: &ElementRc,
repeater_count: u32,
parent_index: u32,
component_state: &Self::SubComponentState
);
fn push_native_item(
&mut self,
item: &ElementRc,
children_offset: u32,
parent_index: u32,
component_state: &Self::SubComponentState
);
fn enter_component(
&mut self,
item: &ElementRc,
sub_component: &Rc<Component>,
children_offset: u32,
component_state: &Self::SubComponentState
) -> Self::SubComponentState;
fn enter_component_children(
&mut self,
item: &ElementRc,
repeater_count: u32,
component_state: &Self::SubComponentState,
sub_component_state: &Self::SubComponentState
);
}
Expand description
A reference to this trait is passed to the build_item_tree
function.
It can be used to build the array for the item tree.
Associated Types
type SubComponentState: Clone
type SubComponentState: Clone
Some state that contains the code on how to access some particular component
Required methods
fn push_repeated_item(
&mut self,
item: &ElementRc,
repeater_count: u32,
parent_index: u32,
component_state: &Self::SubComponentState
)
fn push_native_item(
&mut self,
item: &ElementRc,
children_offset: u32,
parent_index: u32,
component_state: &Self::SubComponentState
)
fn enter_component(
&mut self,
item: &ElementRc,
sub_component: &Rc<Component>,
children_offset: u32,
component_state: &Self::SubComponentState
) -> Self::SubComponentState
fn enter_component(
&mut self,
item: &ElementRc,
sub_component: &Rc<Component>,
children_offset: u32,
component_state: &Self::SubComponentState
) -> Self::SubComponentState
Called when a component is entered, this allow to change the component_state. The returned SubComponentState will be used for all the items within that component
fn enter_component_children(
&mut self,
item: &ElementRc,
repeater_count: u32,
component_state: &Self::SubComponentState,
sub_component_state: &Self::SubComponentState
)
fn enter_component_children(
&mut self,
item: &ElementRc,
repeater_count: u32,
component_state: &Self::SubComponentState,
sub_component_state: &Self::SubComponentState
)
Called before the children of a component are entered.