AppBuilder

Struct AppBuilder 

Source
pub struct AppBuilder<Message, Command, Processor, Router>
where Command: SideEffect<Message>, Processor: Processor<Message, Command>, Router: Route<Message>,
{ /* private fields */ }
Expand description

Struct used to configure and attach an application to the DOM.

Implementations§

Source§

impl<Message, Command, Processor, Router> AppBuilder<Message, Command, Processor, Router>
where Command: SideEffect<Message> + 'static, Processor: Processor<Message, Command> + 'static, Router: Route<Message> + 'static,

Source

pub fn router<R: Route<Message>>( self, router: R, ) -> AppBuilder<Message, Command, Processor, R>

Handle popstate and hashchange events for this app.

The router will need to implement the Route trait.

Source

pub fn clear(self) -> Self

Remove all children from the parent when attaching the app.

This is useful for displaying fallback text or a loading screen that will then be removed when the app is attached.

Source

pub fn attach<Model, DomTree, Key>( self, parent: Element, model: Model, ) -> Rc<RefCell<Box<dyn Application<Message, Command>>>>
where Model: Update<Message, Command> + Render<DomTree> + 'static, DomTree: DomIter<Message, Command, Key> + 'static, Message: Debug + Clone + PartialEq + 'static, Command: SideEffect<Message> + Debug + 'static, Key: Eq + Hash + 'static,

Attach an app to the dom.

The app will be attached at the given parent node and initialized with the given model. Event handlers will be registered as necessary.

Trait Implementations§

Source§

impl<Message, Command> Default for AppBuilder<Message, Command, DefaultProcessor<Message, Command>, ()>
where Command: SideEffect<Message>,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Message, Command, Processor, Router> Freeze for AppBuilder<Message, Command, Processor, Router>
where Processor: Freeze,

§

impl<Message, Command, Processor, Router> RefUnwindSafe for AppBuilder<Message, Command, Processor, Router>
where Processor: RefUnwindSafe, Message: RefUnwindSafe, Command: RefUnwindSafe, Router: RefUnwindSafe,

§

impl<Message, Command, Processor, Router> !Send for AppBuilder<Message, Command, Processor, Router>

§

impl<Message, Command, Processor, Router> !Sync for AppBuilder<Message, Command, Processor, Router>

§

impl<Message, Command, Processor, Router> Unpin for AppBuilder<Message, Command, Processor, Router>
where Processor: Unpin, Message: Unpin, Command: Unpin,

§

impl<Message, Command, Processor, Router> UnwindSafe for AppBuilder<Message, Command, Processor, Router>
where Processor: UnwindSafe, Message: UnwindSafe, Command: UnwindSafe, Router: RefUnwindSafe,

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, 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<M> Update<()> for M

Source§

fn update(&mut self, msg: Message, _commands: &mut Commands<Command>)

Update the model using the given message. Implement this to describe the behavior of your app.
Source§

fn simple_update(&mut self, _msg: Message)

Update the model using the given message. Implement this if your app does not need to use side effecting commands.