pub trait ScopedCpuJob: Send {
// Required method
fn run(&mut self) -> Result<(), CpuDomainExecutorError>;
}Expand description
One borrowed job installed synchronously into a CPU domain executor.
The executor must finish using the job before CpuDomainExecutor::install
returns; a borrowed job never escapes that call.
§Examples
use tenferro_cpu::{CpuDomainExecutorError, ScopedCpuJob};
struct Job(bool);
impl ScopedCpuJob for Job {
fn run(&mut self) -> Result<(), CpuDomainExecutorError> {
self.0 = true;
Ok(())
}
}
let mut job = Job(false);
job.run().unwrap();
assert!(job.0);Required Methods§
Sourcefn run(&mut self) -> Result<(), CpuDomainExecutorError>
fn run(&mut self) -> Result<(), CpuDomainExecutorError>
Run this job once on the executor-selected calling context.
§Examples
use tenferro_cpu::{CpuDomainExecutorError, ScopedCpuJob};
struct Job;
impl ScopedCpuJob for Job {
fn run(&mut self) -> Result<(), CpuDomainExecutorError> { Ok(()) }
}
assert!(Job.run().is_ok());§Errors
Returns CpuDomainExecutorError::Admission,
CpuDomainExecutorError::Scheduling,
CpuDomainExecutorError::Cancellation, or
CpuDomainExecutorError::PanicBridge when that failure is observed
while running the job.