Struct tasklet::TaskBuilder[][src]

pub struct TaskBuilder<'a, T> where
    T: TimeZone
{ /* fields omitted */ }

Task builder function.

Used to generate/build a TaskStep instance.

Implementations

impl<'a, T> TaskBuilder<'a, T> where
    T: TimeZone
[src]

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]

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]

impl<'a, T> !UnwindSafe for TaskBuilder<'a, T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.