Struct yew_agent::prelude::WorkerScope
source · 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§
source§impl<W> WorkerScope<W>where
W: Worker + 'static,
impl<W> WorkerScope<W>where W: Worker + 'static,
sourcepub 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.
sourcepub fn send_message<T>(&self, msg: T)where
T: Into<<W as Worker>::Message>,
pub fn send_message<T>(&self, msg: T)where T: Into<<W as Worker>::Message>,
Send a message to the worker
sourcepub fn callback<F, IN, M>(&self, function: F) -> Rc<dyn Fn(IN)>where
M: Into<<W as Worker>::Message>,
F: Fn(IN) -> M + 'static,
pub fn callback<F, IN, M>(&self, function: F) -> Rc<dyn Fn(IN)>where M: Into<<W as Worker>::Message>, F: Fn(IN) -> M + 'static,
Create a callback which will send a message to the worker when invoked.
sourcepub fn callback_future<FN, FU, IN, M>(&self, function: FN) -> Rc<dyn Fn(IN)>where
M: Into<<W as Worker>::Message>,
FU: Future<Output = M> + 'static,
FN: Fn(IN) -> FU + 'static,
pub fn callback_future<FN, FU, IN, M>(&self, function: FN) -> Rc<dyn Fn(IN)>where M: Into<<W as Worker>::Message>, FU: Future<Output = M> + 'static, FN: Fn(IN) -> FU + 'static,
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§
source§impl<W> Clone for WorkerScope<W>where
W: Worker,
impl<W> Clone for WorkerScope<W>where W: Worker,
source§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> !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
§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.