pub struct Runner {
pub jobs: Vec<Box<dyn Job>>,
pub thread: Option<JoinHandle<()>>,
pub running: bool,
pub tx: Option<UnboundedSender<Result<(), ()>>>,
pub working: Arc<AtomicBool>,
}
Expand description
Runner that will hold all the jobs and will start up the execution and eventually will stop it.
Fields§
§jobs: Vec<Box<dyn Job>>
the current jobs
thread: Option<JoinHandle<()>>
the task that is running the handle
running: bool
is the task running or not
tx: Option<UnboundedSender<Result<(), ()>>>
channel sending message
working: Arc<AtomicBool>
tracker to determine crons working
Implementations§
Source§impl Runner
impl Runner
Sourcepub fn add(self, job: Box<dyn Job>) -> Self
pub fn add(self, job: Box<dyn Job>) -> Self
Add jobs into the runner
Does nothing if already running.
Sourcepub fn jobs_to_run(&self) -> usize
pub fn jobs_to_run(&self) -> usize
Number of jobs ready to start running
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Lets us know if the cron worker is running
Sourcepub fn is_working(&self) -> bool
pub fn is_working(&self) -> bool
Lets us know if the worker is in the process of executing a job currently
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runner
impl !RefUnwindSafe for Runner
impl Send for Runner
impl Sync for Runner
impl Unpin for Runner
impl !UnwindSafe for Runner
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