Trait savory::element::Element[][src]

pub trait Element {
    type Message: 'static;
    type Config;
    fn init(
        config: Self::Config,
        orders: &mut impl Orders<Self::Message>
    ) -> Self;
fn update(&mut self, _: Self::Message, _: &mut impl Orders<Self::Message>); }

Trait used to create element and handle element messages and update element state accordingly.

Element messages can be emitted by HTML events or by other elements, handling these messages is done inside the method update, both init function and update method receive orders argument which provide many useful methods to interact with the runtime library Seed, for example we can subscribe to messages of some type, we can perform async blocks and many more things (see Orders).

Associated Types

type Message: 'static[src]

Element message

type Config[src]

Configuration used to initialize this element

Loading content...

Required methods

fn init(config: Self::Config, orders: &mut impl Orders<Self::Message>) -> Self[src]

Create and initialize the element

Arguments

  • config configuration used to create the element.
  • orders used to interacte with Seed runtime.

fn update(&mut self, _: Self::Message, _: &mut impl Orders<Self::Message>)[src]

update method that recive Self::Message and update the model state accordingly.

Loading content...

Implementors

Loading content...