Struct relm4::RelmComponent

source ·
pub struct RelmComponent<Model, ParentModel>where
    Model: ComponentUpdate<ParentModel> + 'static,
    ParentModel: ModelTrait,
    Model::Widgets: WidgetsTrait<Model, ParentModel> + 'static,
{ /* private fields */ }
Expand description

A component that can be part of the main application or other components.

A RelmComponent has its own widget, model and message type and can send messages to its parent and its children components.

Multiple RelmComponents that have the same parent are usually bundled in a struct that implements Components.

Implementations§

Create a new RelmComponent.

Connect the widgets to the widgets of the parent widget.

Send a message to this component. This can be used by the parent to send messages to this component.

Get a sender to send messages to this component.

Returns the root widget of this component’s widgets. Can be used by the parent to connect the root widget to the parent’s widgets.

Returns a mutable reference to the widgets of this component or None if you already have a reference to the widgets.

Use this carefully and make sure the reference to the widgets is dropped after use because otherwise the view function can’t be called as long you own the widgets (it uses RefCell internally).

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.