pub struct TaskBuilder<Args> { /* private fields */ }Expand description
Builder for creating Task instances with optional configuration
Implementations§
Source§impl<Args> TaskBuilder<Args>
impl<Args> TaskBuilder<Args>
Sourcepub fn with_metadata(self, metadata: MetadataStore) -> Self
pub fn with_metadata(self, metadata: MetadataStore) -> Self
Set the task’s metadata
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 max_attempts(self, max_attempts: usize) -> Self
pub fn max_attempts(self, max_attempts: usize) -> Self
Set the maximum number of attempts allowed for the task
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
Sourcepub fn idempotency_key<S: AsRef<str>>(self, idempotency_key: S) -> Self
pub fn idempotency_key<S: AsRef<str>>(self, idempotency_key: S) -> Self
Set the idempotency key
Source§impl<Args> TaskBuilder<Args>
impl<Args> TaskBuilder<Args>
Sourcepub fn try_map_args<F, NewArgs, Err>(
self,
f: F,
) -> Result<TaskBuilder<NewArgs>, Err>
pub fn try_map_args<F, NewArgs, Err>( self, f: F, ) -> Result<TaskBuilder<NewArgs>, Err>
Maps the args field using the provided function, returning a result.
Sourcepub fn map_args<F, NewArgs>(self, f: F) -> TaskBuilder<NewArgs>where
F: FnOnce(Args) -> NewArgs,
pub fn map_args<F, NewArgs>(self, f: F) -> TaskBuilder<NewArgs>where
F: FnOnce(Args) -> NewArgs,
Maps the args field using the provided function, returning the new args.
Sourcepub fn map_context<F>(self, f: F) -> Self
pub fn map_context<F>(self, f: F) -> Self
Maps only the execution_context field.
Trait Implementations§
Source§impl<Args: Debug> Debug for TaskBuilder<Args>
impl<Args: Debug> Debug for TaskBuilder<Args>
Source§impl<'de, Args> Deserialize<'de> for TaskBuilder<Args>where
Args: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, Args> Deserialize<'de> for TaskBuilder<Args>where
Args: Deserialize<'de>,
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<Args> !RefUnwindSafe for TaskBuilder<Args>
impl<Args> !UnwindSafe for TaskBuilder<Args>
impl<Args> Freeze for TaskBuilder<Args>where
Args: Freeze,
impl<Args> Send for TaskBuilder<Args>where
Args: Send,
impl<Args> Sync for TaskBuilder<Args>where
Args: Sync,
impl<Args> Unpin for TaskBuilder<Args>where
Args: Unpin,
impl<Args> UnsafeUnpin for TaskBuilder<Args>where
Args: UnsafeUnpin,
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