Skip to main content

Task

Struct Task 

Source
pub struct Task { /* private fields */ }
Expand description

First-class immutable task declaration owned by exactly one Phase.

Implementations§

Source§

impl Task

Source

pub fn one_shot<W>( id: impl Into<String>, label: impl Into<String>, workload: W, ) -> Self
where W: FnOnce(&TaskContext) -> TaskResult + Send + 'static,

Creates a one-shot task.

Source

pub fn progress<W>( id: impl Into<String>, label: impl Into<String>, workload: W, ) -> Self
where W: FnOnce(&TaskContext) -> TaskResult + Send + 'static,

Creates a task that may report progress through its context.

Source

pub fn one_shot_for_configuration<W>( category: impl Into<String>, configuration: &ResolvedConfiguration, workload: W, ) -> Self
where W: FnOnce(&TaskContext) -> TaskResult + Send + 'static,

Creates a one-shot task using the conventional configuration identity.

Source

pub fn progress_for_configuration<W>( category: impl Into<String>, configuration: &ResolvedConfiguration, workload: W, ) -> Self
where W: FnOnce(&TaskContext) -> TaskResult + Send + 'static,

Creates a progress task using the conventional configuration identity.

Source

pub fn completed(id: impl Into<String>, label: impl Into<String>) -> Self

Creates an application-verified task that is already satisfied.

Source

pub fn category(self, category: impl Into<String>) -> Self

Sets the optional application-defined task category.

Source

pub fn metadata(self, key: impl Into<String>, value: impl Into<Value>) -> Self

Adds application-defined metadata used for inspection and selection.

Source

pub fn with_configuration(self, configuration: &ResolvedConfiguration) -> Self

Attaches a complete resolved scientific configuration to task provenance.

Source

pub fn with_project_paths(self, paths: &ProjectPaths) -> Self

Attaches the complete named project path table to task provenance.

Source

pub fn key(&self) -> &TaskKey

Returns the exact phase-qualified task key.

Source

pub fn id(&self) -> &TaskId

Returns the phase-local task ID.

Source

pub fn category_name(&self) -> &str

Returns the application-defined task category.

Source

pub fn label(&self) -> &str

Returns the automatically generated display label.

Source

pub const fn mode(&self) -> TaskMode

Returns whether the task reports iterative progress or one-shot status.

Source

pub fn metadata_value(&self, key: &str) -> Option<&Value>

Borrows one application-defined metadata value.

Source

pub fn require_metadata(&self, key: &str) -> Result<&Value, StudyError>

Borrows one required task metadata value.

Source

pub fn decode_metadata<T>(&self, key: &str) -> Result<T, StudyError>

Decodes one required task metadata value without first cloning its JSON tree.

Source

pub fn metadata_iter(&self) -> impl Iterator<Item = (&str, &Value)> + '_

Iterates application-defined metadata.

Trait Implementations§

Source§

impl Debug for Task

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Task

§

impl !Sync for Task

§

impl !UnwindSafe for Task

§

impl Freeze for Task

§

impl Send for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.