[][src]Struct zi::ComponentLink

pub struct ComponentLink<ComponentT> { /* fields omitted */ }

A context for sending messages to a component or the runtime.

It can be used in a multi-threaded environment (implements Sync and Send). Additionally, it can send messages to the runtime, in particular it's used to gracefully stop a running App.

Implementations

impl<ComponentT: Component> ComponentLink<ComponentT>[src]

pub fn send(&self, message: ComponentT::Message)[src]

Sends a message to the component.

pub fn callback<InputT>(
    &self,
    callback: impl Fn(InputT) -> ComponentT::Message + 'static
) -> Callback<InputT>
[src]

Creates a Callback which will send a message to the linked component's update method when invoked.

pub fn exit(&self)[src]

Sends a message to the App runtime requesting it to stop executing.

This method only sends a message and returns immediately, the app will stop asynchronously and may deliver other pending messages before exiting.

pub fn run_exclusive(
    &self,
    process: impl FnOnce() -> Option<ComponentT::Message> + Send + 'static
)
[src]

Runs a closure that requires exclusive access to the backend (i.e. typically to stdin / stdout). For example spawning an external editor to collect some text.

Trait Implementations

impl<ComponentT> Clone for ComponentLink<ComponentT>[src]

impl<ComponentT: Debug> Debug for ComponentLink<ComponentT>[src]

Auto Trait Implementations

impl<ComponentT> !RefUnwindSafe for ComponentLink<ComponentT>

impl<ComponentT> Send for ComponentLink<ComponentT>

impl<ComponentT> Sync for ComponentLink<ComponentT>

impl<ComponentT> Unpin for ComponentLink<ComponentT>

impl<ComponentT> !UnwindSafe for ComponentLink<ComponentT>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.