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;
    // Required methods
    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.
Required Associated Types§
sourcetype Root: WidgetExt
 
type Root: WidgetExt
Outermost type of the newly created widgets.
Similar to the Root type in crate::Widgets.
sourcetype View: FactoryView<Self::Root>
 
type View: FactoryView<Self::Root>
Widget that the generated widgets are added to.
Required Methods§
sourcefn init_view(
    &self,
    key: &<Self::Factory as Factory<Self, Self::View>>::Key,
    sender: Sender<Self::Msg>
) -> Self::Widgets
 
fn init_view( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key, sender: Sender<Self::Msg> ) -> Self::Widgets
Create new widgets when self is inserted into the factory.
sourcefn position(
    &self,
    key: &<Self::Factory as Factory<Self, Self::View>>::Key
) -> <Self::View as FactoryView<Self::Root>>::Position
 
fn position( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key ) -> <Self::View as FactoryView<Self::Root>>::Position
Set the widget position upon creation, useful for gtk::Grid or similar.
sourcefn view(
    &self,
    key: &<Self::Factory as Factory<Self, Self::View>>::Key,
    widgets: &Self::Widgets
)
 
fn view( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key, widgets: &Self::Widgets )
Function called when self is modified.
sourcefn root_widget(widgets: &Self::Widgets) -> &Self::Root
 
fn root_widget(widgets: &Self::Widgets) -> &Self::Root
Get the outermost widget from the widgets.