pub struct WebPWorker<D1, D2> { /* private fields */ }Expand description
A worker that runs one hook on its job, on a thread or on the caller’s
thread (C: WebPWorker).
Implementations§
Source§impl<D1, D2> WebPWorker<D1, D2>
impl<D1, D2> WebPWorker<D1, D2>
Sourcepub fn set_job(&mut self, hook: WebPWorkerHook<D1, D2>, data1: D1, data2: D2)
pub fn set_job(&mut self, hook: WebPWorkerHook<D1, D2>, data1: D1, data2: D2)
Sets the hook and the data that the next launch or execute runs (C:
setting hook, data1 and data2).
§Panics
Panics while the worker is working: C forbids the change until sync.
Sourcepub fn job_data(&self) -> Option<(&D1, &D2)>
pub fn job_data(&self) -> Option<(&D1, &D2)>
The data of the current job; None when there is no job or the worker
is working, because the thread then owns the data.
Sourcepub fn job_data_mut(&mut self) -> Option<(&mut D1, &mut D2)>
pub fn job_data_mut(&mut self) -> Option<(&mut D1, &mut D2)>
Mutable access to the data of the current job, under the same rule as
WebPWorker::job_data.
Sourcepub fn status(&self) -> WebPWorkerStatus
pub fn status(&self) -> WebPWorkerStatus
The current status (C: the status field).
Sourcepub fn had_error(&self) -> bool
pub fn had_error(&self) -> bool
Whether the hook has failed since the last reset (C: the had_error
field).
Sourcepub fn execute(&mut self)
pub fn execute(&mut self)
Runs the hook on the calling thread and records a failure (C: Execute).
A worker without a job does nothing.
Sourcepub fn launch(&mut self)
pub fn launch(&mut self)
Starts the job on the thread (C: Launch). Without a thread nothing
starts and the hook does not run, as in C.