pub struct TaskBuilder<Args, Ctx, IdType> { /* private fields */ }Expand description
Builder for creating Task instances with optional configuration
Implementations§
Source§impl<Args, Ctx, IdType> TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> TaskBuilder<Args, Ctx, IdType>
Sourcepub fn new(args: Args) -> Selfwhere
Ctx: Default,
pub fn new(args: Args) -> Selfwhere
Ctx: Default,
Create a new TaskBuilder with the required args
Sourcepub fn with_data(self, data: Extensions) -> Self
pub fn with_data(self, data: Extensions) -> Self
Set the task’s runtime data
Sourcepub fn data<D: Clone + Send + Sync + 'static>(self, value: D) -> Self
pub fn data<D: Clone + Send + Sync + 'static>(self, value: D) -> Self
Insert a value into the task’s data context
Sourcepub fn meta<M>(self, value: M) -> Selfwhere
Ctx: MetadataExt<M>,
pub fn meta<M>(self, value: M) -> Selfwhere
Ctx: MetadataExt<M>,
Insert a value into the task’s ctx context
Sourcepub fn with_task_id(self, task_id: TaskId<IdType>) -> Self
pub fn with_task_id(self, task_id: TaskId<IdType>) -> Self
Set the task ID
Sourcepub fn with_attempt(self, attempt: Attempt) -> Self
pub fn with_attempt(self, attempt: Attempt) -> Self
Set the attempt information
Sourcepub fn with_status(self, status: Status) -> Self
pub fn with_status(self, status: Status) -> Self
Set the task status
Sourcepub fn run_at_timestamp(self, timestamp: u64) -> Self
pub fn run_at_timestamp(self, timestamp: u64) -> Self
Schedule the task to run at a specific Unix timestamp
Sourcepub fn run_at_time(self, time: SystemTime) -> Self
pub fn run_at_time(self, time: SystemTime) -> Self
Schedule the task to run at a specific SystemTime
Sourcepub fn run_after(self, delay: Duration) -> Self
pub fn run_after(self, delay: Duration) -> Self
Schedule the task to run after a delay from now
Sourcepub fn run_in_seconds(self, seconds: u64) -> Self
pub fn run_in_seconds(self, seconds: u64) -> Self
Schedule the task to run in the specified number of seconds
Sourcepub fn run_in_minutes(self, minutes: u64) -> Self
pub fn run_in_minutes(self, minutes: u64) -> Self
Schedule the task to run in the specified number of minutes
Sourcepub fn run_in_hours(self, hours: u64) -> Self
pub fn run_in_hours(self, hours: u64) -> Self
Schedule the task to run in the specified number of hours
Trait Implementations§
Auto Trait Implementations§
impl<Args, Ctx, IdType> Freeze for TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> !RefUnwindSafe for TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> Send for TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> Sync for TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> Unpin for TaskBuilder<Args, Ctx, IdType>
impl<Args, Ctx, IdType> !UnwindSafe for TaskBuilder<Args, Ctx, IdType>
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