Skip to main content

TaskBuilder

Struct TaskBuilder 

Source
pub struct TaskBuilder<Args> { /* private fields */ }
Expand description

Builder for creating Task instances with optional configuration

Implementations§

Source§

impl<Args> TaskBuilder<Args>

Source

pub fn new(args: Args) -> TaskBuilder<Args>

Create a new TaskBuilder with the required args

Source

pub fn with_metadata(self, metadata: MetadataStore) -> TaskBuilder<Args>

Set the task’s metadata

Source

pub fn with_data(self, data: Extensions) -> TaskBuilder<Args>

Set the task’s runtime data

Source

pub fn data<D>(self, value: D) -> TaskBuilder<Args>
where D: Clone + Send + Sync + 'static,

Insert a value into the task’s data context

Source

pub fn metadata<M>(self, value: &M) -> TaskBuilder<Args>
where M: Metadata, <M as Metadata>::Error: Debug,

Insert a value into the task’s metadata

Source

pub fn task_id(self, task_id: TaskId) -> TaskBuilder<Args>

Set the task ID

Source

pub fn attempt(self, attempt: usize) -> TaskBuilder<Args>

Set the attempt information

Source

pub fn status(self, status: Status) -> TaskBuilder<Args>

Set the task status

Source

pub fn max_attempts(self, max_attempts: usize) -> TaskBuilder<Args>

Set the maximum number of attempts allowed for the task

Source

pub fn priority(self, priority: usize) -> TaskBuilder<Args>

Set the priority of the task

Source

pub fn queue(self, queue: Queue) -> TaskBuilder<Args>

Set the queue this task belongs to

Source

pub fn run_at_timestamp(self, timestamp: u64) -> TaskBuilder<Args>

Schedule the task to run at a specific Unix timestamp

Source

pub fn run_at_time(self, time: SystemTime) -> TaskBuilder<Args>

Schedule the task to run at a specific SystemTime

Source

pub fn run_after(self, delay: Duration) -> TaskBuilder<Args>

Schedule the task to run after a delay from now

Source

pub fn run_in_seconds(self, seconds: u64) -> TaskBuilder<Args>

Schedule the task to run in the specified number of seconds

Source

pub fn run_in_minutes(self, minutes: u64) -> TaskBuilder<Args>

Schedule the task to run in the specified number of minutes

Source

pub fn run_in_hours(self, hours: u64) -> TaskBuilder<Args>

Schedule the task to run in the specified number of hours

Source

pub fn idempotency_key<S>(self, idempotency_key: S) -> TaskBuilder<Args>
where S: AsRef<str>,

Set the idempotency key

Source

pub fn done_at(self, done_at: Option<u64>) -> TaskBuilder<Args>

Set the time the task was completed

Source

pub fn lock_at(self, lock_at: Option<u64>) -> TaskBuilder<Args>

Set the time the task was locked

Source

pub fn lock_by(self, lock_by: Option<String>) -> TaskBuilder<Args>

Set the worker/process identifier holding the lock on this task

Source

pub fn build(self) -> Task<Args>

Build the Task with default context

Source§

impl<Args> TaskBuilder<Args>

Source

pub fn try_map_args<F, NewArgs, Err>( self, f: F, ) -> Result<TaskBuilder<NewArgs>, Err>
where F: FnOnce(Args) -> Result<NewArgs, Err>,

Maps the args field using the provided function, returning a result.

Source

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.

Source

pub fn map_context<F>(self, f: F) -> TaskBuilder<Args>

Maps only the execution_context field.

Trait Implementations§

Source§

impl<Args> Debug for TaskBuilder<Args>
where Args: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de, Args> Deserialize<'de> for TaskBuilder<Args>
where Args: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TaskBuilder<Args>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Args> RetryMetadataExt for TaskBuilder<Args>

Source§

fn retries(self, retries: usize) -> TaskBuilder<Args>

Set number of retries in the metadata

Source§

impl<Args> Serialize for TaskBuilder<Args>
where Args: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<Args> !RefUnwindSafe for TaskBuilder<Args>

§

impl<Args> !UnwindSafe for TaskBuilder<Args>

§

impl<Args> Forget for TaskBuilder<Args>

§

impl<Args> Freeze for TaskBuilder<Args>
where Args: Freeze,

§

impl<Args> Move for TaskBuilder<Args>

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoPageProps for T
where T: Serialize,

Source§

fn into_page_props( self, component: &str, request: &RequestContext, metadata: PageMetadata, ) -> Result<(Value, PageMetadata, Vec<String>), Error>

Builds the concrete JSON props object, response metadata, and route prop roots for shared-prop collision handling.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more