pub struct Emitter<T> { /* private fields */ }Expand description
The worker’s handle to a spawn_stream, for posting items back to the UI thread. Send and cloneable,
so the work can hand it to nested helpers or a callback-driven library.
Implementations§
Source§impl<T: Send + 'static> Emitter<T>
impl<T: Send + 'static> Emitter<T>
Sourcepub fn emit(&self, item: T)
pub fn emit(&self, item: T)
Posts one item and wakes the UI loop. A no-op once the stream is cancelled.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the Task was cancelled. A long-running worker should poll this and return — nothing else
can stop it, and everything it emits from here on is discarded.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Emitter<T>
impl<T> RefUnwindSafe for Emitter<T>
impl<T> Send for Emitter<T>
impl<T> Sync for Emitter<T>
impl<T> Unpin for Emitter<T>
impl<T> UnsafeUnpin for Emitter<T>
impl<T> UnwindSafe for Emitter<T>
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