Skip to main content

NamedTask

Trait NamedTask 

Source
pub trait NamedTask: Future + Sized {
    // Required methods
    fn detail(self, detail: impl FnOnce() -> String + Send + 'static) -> Self;
    fn external(self) -> Self;
}
Expand description

What a named task offers beyond being a future. Bring it into scope to call detail or external.

Without the control feature every future implements it and both methods return the future unchanged. With control only [Named] does, so call them only on the value TaskName::task returns.

Required Methods§

Source

fn detail(self, detail: impl FnOnce() -> String + Send + 'static) -> Self

Text shown in traces and matched by tests, such as the id of the note being saved. The closure runs only under a harness.

Source

fn external(self) -> Self

Marks the task as finished by a thread the harness does not own, such as the app’s own worker. While it is in flight a harness waits for it rather than calling the app idle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F: Future> NamedTask for F

Available on non-crate feature control only.