pub struct Worker { /* private fields */ }Expand description
A worker thread that can be paused, stopped, and resumed.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn run<T>(
&self,
f: impl FnOnce() -> T + Send + 'static,
) -> Result<Receiver<T>, SendError<Box<dyn FnOnce() + Send>>>where
T: Send + 'static,
pub fn run<T>(
&self,
f: impl FnOnce() -> T + Send + 'static,
) -> Result<Receiver<T>, SendError<Box<dyn FnOnce() + Send>>>where
T: Send + 'static,
Run f on the worker thread.
Sourcepub fn resume(&self) -> bool
pub fn resume(&self) -> bool
Resumes the Worker from a paused or stopped state into a running state.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns true if running.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns true if stopped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Worker
impl !RefUnwindSafe for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl !UnwindSafe for Worker
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