Struct tasklet::TaskScheduler [−][src]
Task scheduler and executor.
Implementations
impl<'a, T> TaskScheduler<'a, T> where
T: TimeZone + Clone,
[src]
T: TimeZone + Clone,
TaskScheduler
implementation.
pub fn new(sleep: usize, timezone: T) -> TaskScheduler<'a, T>
[src]
Create a new instance of TaskScheduler
with no tasks to execute.
Arguments
- sleep - The execution frequency (in ms).
- timezone - The scheduler's timezone.
Examples
// Create a new `TaskScheduler` instance that executes every 1000ms. let _schedule = TaskScheduler::new(1000, chrono::Local);
pub fn set_task_gen(
&mut self,
task_gen: TaskGenerator<'a, T>
) -> &mut TaskScheduler<'a, T>
[src]
&mut self,
task_gen: TaskGenerator<'a, T>
) -> &mut TaskScheduler<'a, T>
Set a TaskGenerator
inistance for the TaskScheduler.
Arguments
- task_gen - a
TaskGenerator
instance.
Examples
// Create a new `TashSceduler` instance and attach an `TaskGenerator` to it. let mut scheduler = TaskScheduler::new(1000, chrono::Local); let mut generator = TaskGenerator::new("1 * * * * * *", chrono::Local, || None); scheduler.set_task_gen(generator);
pub fn add_task(&mut self, task: Task<'a, T>) -> &mut TaskScheduler<'a, T>
[src]
Add a new task in the execution queue.
Arguments
- task - a
Task
instance.
Examples
// Create a new `TaskScheduler` and attach a task to it. let mut scheduler = TaskScheduler::new(1000, chrono::Local); // Add a task that executes every second forever. scheduler.add_task(Task::new("* * * * * * *", None, None, chrono::Local));
pub fn run(&mut self)
[src]
Main execution loop.
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for TaskScheduler<'a, T>
[src]
impl<'a, T> !Send for TaskScheduler<'a, T>
[src]
impl<'a, T> !Sync for TaskScheduler<'a, T>
[src]
impl<'a, T> Unpin for TaskScheduler<'a, T> where
T: Unpin,
<T as TimeZone>::Offset: Unpin,
[src]
T: Unpin,
<T as TimeZone>::Offset: Unpin,
impl<'a, T> !UnwindSafe for TaskScheduler<'a, T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,