Trait relm4::factory::FactoryPrototype
source · [−]pub trait FactoryPrototype: Sized {
type Factory: Factory<Self, Self::View>;
type Widgets: Debug;
type Root: WidgetExt;
type View: FactoryView<Self::Root>;
type Msg;
fn init_view(
&self,
key: &<Self::Factory as Factory<Self, Self::View>>::Key,
sender: Sender<Self::Msg>
) -> Self::Widgets;
fn position(
&self,
key: &<Self::Factory as Factory<Self, Self::View>>::Key
) -> <Self::View as FactoryView<Self::Root>>::Position;
fn view(
&self,
key: &<Self::Factory as Factory<Self, Self::View>>::Key,
widgets: &Self::Widgets
);
fn root_widget(widgets: &Self::Widgets) -> &Self::Root;
}
Expand description
Define behavior to create, update and remove widgets according to data stored in a factory.
Associated Types
Outermost type of the newly created widgets.
Similar to the Root
type in crate::Widgets
.
type View: FactoryView<Self::Root>
type View: FactoryView<Self::Root>
Widget that the generated widgets are added to.
Required methods
Create new widgets when self is inserted into the factory.
Set the widget position upon creation, useful for gtk::Grid
or similar.
Function called when self is modified.
fn root_widget(widgets: &Self::Widgets) -> &Self::Root
fn root_widget(widgets: &Self::Widgets) -> &Self::Root
Get the outermost widget from the widgets.