pub struct Task { /* private fields */ }Expand description
First-class immutable task declaration owned by exactly one Phase.
Implementations§
Source§impl Task
impl Task
Sourcepub fn one_shot<W>(
id: impl Into<String>,
label: impl Into<String>,
workload: W,
) -> Self
pub fn one_shot<W>( id: impl Into<String>, label: impl Into<String>, workload: W, ) -> Self
Creates a one-shot task.
Sourcepub fn progress<W>(
id: impl Into<String>,
label: impl Into<String>,
workload: W,
) -> Self
pub fn progress<W>( id: impl Into<String>, label: impl Into<String>, workload: W, ) -> Self
Creates a task that may report progress through its context.
Sourcepub fn one_shot_for_configuration<W>(
category: impl Into<String>,
configuration: &ResolvedConfiguration,
workload: W,
) -> Self
pub fn one_shot_for_configuration<W>( category: impl Into<String>, configuration: &ResolvedConfiguration, workload: W, ) -> Self
Creates a one-shot task using the conventional configuration identity.
Sourcepub fn progress_for_configuration<W>(
category: impl Into<String>,
configuration: &ResolvedConfiguration,
workload: W,
) -> Self
pub fn progress_for_configuration<W>( category: impl Into<String>, configuration: &ResolvedConfiguration, workload: W, ) -> Self
Creates a progress task using the conventional configuration identity.
Sourcepub fn completed(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn completed(id: impl Into<String>, label: impl Into<String>) -> Self
Creates an application-verified task that is already satisfied.
Sourcepub fn category(self, category: impl Into<String>) -> Self
pub fn category(self, category: impl Into<String>) -> Self
Sets the optional application-defined task category.
Sourcepub fn metadata(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn metadata(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Adds application-defined metadata used for inspection and selection.
Sourcepub fn with_configuration(self, configuration: &ResolvedConfiguration) -> Self
pub fn with_configuration(self, configuration: &ResolvedConfiguration) -> Self
Attaches a complete resolved scientific configuration to task provenance.
Sourcepub fn with_project_paths(self, paths: &ProjectPaths) -> Self
pub fn with_project_paths(self, paths: &ProjectPaths) -> Self
Attaches the complete named project path table to task provenance.
Sourcepub fn category_name(&self) -> &str
pub fn category_name(&self) -> &str
Returns the application-defined task category.
Sourcepub const fn mode(&self) -> TaskMode
pub const fn mode(&self) -> TaskMode
Returns whether the task reports iterative progress or one-shot status.
Sourcepub fn metadata_value(&self, key: &str) -> Option<&Value>
pub fn metadata_value(&self, key: &str) -> Option<&Value>
Borrows one application-defined metadata value.
Sourcepub fn require_metadata(&self, key: &str) -> Result<&Value, StudyError>
pub fn require_metadata(&self, key: &str) -> Result<&Value, StudyError>
Borrows one required task metadata value.
Sourcepub fn decode_metadata<T>(&self, key: &str) -> Result<T, StudyError>where
T: DeserializeOwned,
pub fn decode_metadata<T>(&self, key: &str) -> Result<T, StudyError>where
T: DeserializeOwned,
Decodes one required task metadata value without first cloning its JSON tree.
Sourcepub fn metadata_iter(&self) -> impl Iterator<Item = (&str, &Value)> + '_
pub fn metadata_iter(&self) -> impl Iterator<Item = (&str, &Value)> + '_
Iterates application-defined metadata.
Trait Implementations§
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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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