[][src]Struct wlambda::threads::MsgHandle

pub struct MsgHandle { /* fields omitted */ }

This a messaging handle for providing receiver and sender handles for the inter thread communication of WLambda instances.

The communication is internally done either by RPC or by async message passing. The VVal or WLambda values are serialized as msgpack internally for transmission to the other thread. This is not a high speed interface, as serialization and allocations are done.

The communication between WLambda thread instances can be done by multiple senders and multiple receivers, but bear in mind, that in case of RPC one RPC call will lock out all other sender and receiver thread, as RPC calls are synchronous.

Pass this MsgHandle to the receiver thread or multiple threads. You can clone this handle if you want to use it in multiple threads.

See also threads module

Methods

impl MsgHandle[src]

pub fn new() -> Self[src]

pub fn sender(&self) -> Sender[src]

Returns a Sender handle.

pub fn run(&mut self, ctx: &mut EvalContext)[src]

Starts executing Sender requests infinitely long. A global thread:quit function is defined, which can be used to stop this infinitely long loop.

pub fn step(&mut self, ctx: &mut EvalContext, timeout: &Duration) -> Option<()>[src]

Tries to execute a RPC call or received message if the request is received within timeout duration. Returns None if something went wrong. Otherwise Some(()) is returned.

Trait Implementations

impl Clone for MsgHandle[src]

impl Default for MsgHandle[src]

Auto Trait Implementations

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.