pub struct BasicTask { /* private fields */ }Expand description
A task whose body is an async closure.
This is the workhorse for ad-hoc workflows and tests:
use dag_executor::tasks::BasicTask;
let t = BasicTask::new("greet", |_ctx| async { Ok(serde_json::json!("hi")) })
.with_deps(["setup"])
.with_priority(10);Implementations§
Source§impl BasicTask
impl BasicTask
Sourcepub fn new<F, Fut>(id: impl Into<String>, f: F) -> Self
pub fn new<F, Fut>(id: impl Into<String>, f: F) -> Self
Create a task with id id running async closure f.
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set the scheduling priority (higher runs first).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BasicTask
impl !UnwindSafe for BasicTask
impl Freeze for BasicTask
impl Send for BasicTask
impl Sync for BasicTask
impl Unpin for BasicTask
impl UnsafeUnpin for BasicTask
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