Component

Struct Component 

Source
pub struct Component { /* private fields */ }
Expand description

Main relm component of the application

Most importantly implements relm::Widget as an UI application. See Component::view for initialization code.

Trait Implementations§

Source§

impl Update for Component

Source§

type Model = ViewModel

The type of the model.
Source§

type ModelParam = ()

The type of the parameter of the model() function used to initialize the model.
Source§

type Msg = Msg

The type of the messages sent to the update() method.
Source§

fn model(_relm: &Relm<Self>, _model: Self::ModelParam) -> Self::Model

Create the initial model.
Source§

fn update(&mut self, event: Msg)

Method called when a message is received from an event.
Source§

fn subscriptions(&mut self, _relm: &Relm<Self>)

Connect the subscriptions. Subscriptions are Future/Stream that are spawn when the object is created.
Source§

impl Widget for Component

Source§

type Root = ApplicationWindow

The type of the root widget.
Source§

fn root(&self) -> Self::Root

Get the root widget of the view.
Source§

fn view(relm: &Relm<Self>, model: Self::Model) -> Self

Create the initial view.
Source§

fn init_view(&mut self)

Update the view after it is initially created. This method is only useful when using the #[widget] attribute, because when not using it, you can use the view() method instead.
Source§

fn on_add<W>(&self, _parent: W)
where W: IsA<Widget> + IsA<Object>,

Method called when the widget is added to its parent. This is currently only used to set the child properties of a widget as relm widget could have child properties and we don’t know its parent when it is defined. Thus, we call on_add() when it is added to its parent to set the child properties.
Source§

fn parent_id() -> Option<&'static str>

Get the parent ID. This is useful for custom Container implementation: when you implement the Container::add_widget(), you might want to insert widgets elsewhere depending of this id.
Source§

fn run(model_param: Self::ModelParam) -> Result<(), BoolError>
where Self: 'static,

Create the window from this widget and start the main loop.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,