Struct WorkerScope
pub struct WorkerScope<W>where
W: Worker,{ /* private fields */ }
Expand description
This struct holds a reference to a component and to a global scheduler.
Implementations§
§impl<W> WorkerScope<W>where
W: Worker + 'static,
impl<W> WorkerScope<W>where
W: Worker + 'static,
pub fn respond(&self, id: HandlerId, output: <W as Worker>::Output)
pub fn respond(&self, id: HandlerId, output: <W as Worker>::Output)
Send response to a worker bridge.
pub fn send_message<T>(&self, msg: T)
pub fn send_message<T>(&self, msg: T)
Send a message to the worker
pub fn callback<F, IN, M>(&self, function: F) -> Rc<dyn Fn(IN)>
pub fn callback<F, IN, M>(&self, function: F) -> Rc<dyn Fn(IN)>
Create a callback which will send a message to the worker when invoked.
pub fn callback_future<FN, FU, IN, M>(&self, function: FN) -> Rc<dyn Fn(IN)>
pub fn callback_future<FN, FU, IN, M>(&self, function: FN) -> Rc<dyn Fn(IN)>
This method creates a callback which returns a Future which returns a message to be sent back to the worker
§Panics
If the future panics, then the promise will not resolve, and will leak.
Trait Implementations§
§impl<W> Clone for WorkerScope<W>where
W: Worker,
impl<W> Clone for WorkerScope<W>where
W: Worker,
§fn clone(&self) -> WorkerScope<W>
fn clone(&self) -> WorkerScope<W>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<W> Freeze for WorkerScope<W>
impl<W> !RefUnwindSafe for WorkerScope<W>
impl<W> !Send for WorkerScope<W>
impl<W> !Sync for WorkerScope<W>
impl<W> Unpin for WorkerScope<W>
impl<W> !UnwindSafe for WorkerScope<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.