Struct tasklet::TaskBuilder [−][src]
Task builder function.
Used to generate/build a TaskStep
instance.
Implementations
impl<'a, T> TaskBuilder<'a, T> where
T: TimeZone,
[src]
T: TimeZone,
pub fn new(timezone: T) -> TaskBuilder<'a, T>
[src]
Create a new TaskBuilder
instance.
Arguments
- timezone - A valid timezone for the generated
Task
.
Examples
let _task_builder = TaskBuilder::new(chrono::Utc);
pub fn description(mut self: Self, description: &str) -> TaskBuilder<'a, T>
[src]
Set the optional description of the generated Task
.
Arguments
- description - A descripotion for the task.
let _task = TaskBuilder::new(chrono::Local).every("* * * * * * *").description("Description").build();
pub fn every(mut self: Self, expression: &str) -> TaskBuilder<'a, T>
[src]
Set the execution schedule of the task to be generated.
Arguments
- expression - A valid cron expression.
Examples
let _task = TaskBuilder::new(chrono::Local).every("* * * * * * *").build();
pub fn repeat(mut self: Self, repeat: usize) -> TaskBuilder<'a, T>
[src]
Set the max repeats for the generated Task
.
Arguments
- repeats - The max amount of repeats.
Examples
let _task = TaskBuilder::new(chrono::Local).repeat(5);
pub fn add_step<F>(
mut self: Self,
description: Option<&str>,
function: F
) -> TaskBuilder<'a, T> where
F: FnMut() -> Result<(), ()> + 'a,
[src]
mut self: Self,
description: Option<&str>,
function: F
) -> TaskBuilder<'a, T> where
F: FnMut() -> Result<(), ()> + 'a,
Add a new step for the generated task.
Arguments
- description - An optional description for the task's step.
- function - The executable body of the task's step.
Examples
let _task = TaskBuilder::new(chrono::Local).add_step(None, || Ok(())); let _task = TaskBuilder::new(chrono::Utc).add_step(Some("A step that fails."), || Err(()));
pub fn build(self) -> Task<'a, T>
[src]
Build a new Task
instance from the current configuration.
Examples
let mut _task = TaskBuilder::new(chrono::Utc).build();
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for TaskBuilder<'a, T>
[src]
impl<'a, T> !Send for TaskBuilder<'a, T>
[src]
impl<'a, T> !Sync for TaskBuilder<'a, T>
[src]
impl<'a, T> Unpin for TaskBuilder<'a, T> where
T: Unpin,
[src]
T: Unpin,
impl<'a, T> !UnwindSafe for TaskBuilder<'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>,