[][src]Struct mogwai::component::GizmoComponent

pub struct GizmoComponent<T: Component> {
    pub trns: Transmitter<T::ModelMsg>,
    pub recv: Receiver<T::ViewMsg>,
    // some fields omitted
}

A component and all of its pieces.

TODO: Think about renaming Gizmo to Dom and GizmoComponent to Gizmo. I think people will use this GizmoComponent more often.

Fields

trns: Transmitter<T::ModelMsg>recv: Receiver<T::ViewMsg>

Methods

impl<T> GizmoComponent<T> where
    T: Component + 'static,
    T::ViewMsg: Clone,
    T::DomNode: AsRef<Node> + Clone
[src]

pub fn new(init: T) -> GizmoComponent<T>[src]

pub fn dom_ref(&self) -> &T::DomNode[src]

A reference to the DomNode.

pub fn gizmo_ref(&self) -> &Gizmo<T::DomNode>[src]

A reference to the Gizmo.

pub fn rx_from(self, rx: Receiver<T::ModelMsg>) -> GizmoComponent<T>[src]

Send model messages into this component from a Receiver<T::ModelMsg>. This is helpful for sending messages to this component from a parent component.

pub fn tx_into(self, tx: &Transmitter<T::ViewMsg>) -> GizmoComponent<T>[src]

Send view messages from this component into a Transmitter<T::ViewMsg>. This is helpful for sending messages to this component from a parent component.

pub fn run_init(self, msgs: Vec<T::ModelMsg>) -> Result<(), JsValue>[src]

Run and initialize the component with a list of messages. This is equivalent to calling run and update with each message.

pub fn run(self) -> Result<(), JsValue>[src]

Run this component forever

pub fn update(&mut self, msg: &T::ModelMsg)[src]

Update the component with the given message. This how a parent component communicates down to its child components.

pub fn with_state<F, N>(&self, f: F) -> N where
    F: Fn(&T) -> N, 
[src]

Access the component's underlying state.

Methods from Deref<Target = Gizmo<T::DomNode>>

Trait Implementations

impl<T: Component> Deref for GizmoComponent<T>[src]

type Target = Gizmo<T::DomNode>

The resulting type after dereferencing.

impl<T> SubGizmo for GizmoComponent<T> where
    T: Component,
    T::DomNode: AsRef<Node>, 
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for GizmoComponent<T>

impl<T> !Send for GizmoComponent<T>

impl<T> !Sync for GizmoComponent<T>

impl<T> Unpin for GizmoComponent<T> where
    <T as Component>::DomNode: Unpin

impl<T> !UnwindSafe for GizmoComponent<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SubGizmo for T where
    T: Component,
    <T as Component>::DomNode: AsRef<Node>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.