Struct scheduled_executor::executor::CoreExecutor
[−]
[src]
pub struct CoreExecutor { /* fields omitted */ }
A CoreExecutor
is the most simple executor provided. It runs a single thread, which is
responsible for both scheduling the function (registering the timer for the wakeup),
and the actual execution. The executor will stop once dropped. The CoreExecutor
can be cloned to generate a new reference to the same underlying executor.
Given the single threaded nature of this executor, tasks are executed sequentially, and a long
running task will cause delay in other subsequent executions.
Methods
impl CoreExecutor
[src]
fn new() -> Result<CoreExecutor, Error>
Creates a new CoreExecutor
.
fn with_name(thread_name: &str) -> Result<CoreExecutor, Error>
Creates a new CoreExecutor
with the specified thread name.
fn schedule_fixed_interval<F>(
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Handle) + Send + 'static,
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Handle) + Send + 'static,
Schedule a function for running at fixed intervals. The executor will try to run the
function every interval
, but if one execution takes longer than interval
it will delay
all the subsequent calls.
fn schedule_fixed_rate<F>(
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Handle) + Send + 'static,
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Handle) + Send + 'static,
Schedule a function for running at fixed rate. The executor will try to run the function
every interval
, and if a task execution takes longer than interval
, the wait time
between task will be reduced to decrease the overall delay.
Trait Implementations
impl Clone for CoreExecutor
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more