[−][src]Struct mogwai::component::GizmoComponent
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]
T: Component + 'static,
T::ViewMsg: Clone,
T::DomNode: AsRef<Node> + Clone,
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]
F: Fn(&T) -> N,
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.
fn deref(&self) -> &Gizmo<T::DomNode>
[src]
impl<T> SubGizmo for GizmoComponent<T> where
T: Component,
T::DomNode: AsRef<Node>,
[src]
T: Component,
T::DomNode: AsRef<Node>,
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,
<T as Component>::DomNode: Unpin,
impl<T> !UnwindSafe for GizmoComponent<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SubGizmo for T where
T: Component,
<T as Component>::DomNode: AsRef<Node>,
[src]
T: Component,
<T as Component>::DomNode: AsRef<Node>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,