pub struct Worker { /* private fields */ }Expand description
Handle to the worker thread. Dropping it stops the thread.
Implementations§
Source§impl Worker
impl Worker
Sourcepub fn spawn<S, F>(make_source: F, interval: Duration) -> Self
pub fn spawn<S, F>(make_source: F, interval: Duration) -> Self
Starts the worker. make_source runs on the worker thread, so slow
initialization (NVML, warm-up sample, SSH connection) does not delay
the first frame.
Sourcepub fn spawn_with_notify<S, F, N>(
make_source: F,
interval: Duration,
notify: N,
) -> Self
pub fn spawn_with_notify<S, F, N>( make_source: F, interval: Duration, notify: N, ) -> Self
Like Worker::spawn, and calls notify after every event so that
an event-driven UI (e.g. egui’s request_repaint) can wake up instead
of polling.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Worker
impl !Sync for Worker
impl !UnwindSafe for Worker
impl Freeze for Worker
impl Send for Worker
impl Unpin for Worker
impl UnsafeUnpin 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