pub struct Job { /* private fields */ }Expand description
a background job: count items of f on the workers; wake() when it is finished
Implementations§
Source§impl Job
impl Job
pub fn new() -> Job
Sourcepub fn set(
&mut self,
count: u64,
f: impl Fn(usize, &JobCtl) + Send + Sync + 'static,
) -> bool
pub fn set( &mut self, count: u64, f: impl Fn(usize, &JobCtl) + Send + Sync + 'static, ) -> bool
the work of the next start: count items of f (false while the job runs)
Sourcepub fn set_count(&mut self, count: u64) -> bool
pub fn set_count(&mut self, count: u64) -> bool
another item count for the same function (false while the job runs)
Sourcepub fn start(&self) -> bool
pub fn start(&self) -> bool
run it in the background; false: it is still running [thr_job_start]
Sourcepub fn wait(&self) -> Result<(), Cancelled>
pub fn wait(&self) -> Result<(), Cancelled>
block until the job is finished (this thread helps with items not taken yet)
pub fn items_done(&self) -> u64
pub fn count(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Job
impl !UnwindSafe for Job
impl Forget for Job
impl Freeze for Job
impl Send for Job
impl Sync for Job
impl Unpin for Job
impl UnsafeUnpin for Job
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