pub struct EventDrivenTask { /* private fields */ }Expand description
A task that waits for a named event on the Context event bus before
running its handler.
Events are emitted via Context::emit. This enables event-driven
workflows where some tasks block until an external signal (a webhook, a
human approval, another task) arrives. An optional timeout bounds the wait.
Implementations§
Source§impl EventDrivenTask
impl EventDrivenTask
Sourcepub fn new<F, Fut>(
id: impl Into<String>,
event: impl Into<String>,
handler: F,
) -> Self
pub fn new<F, Fut>( id: impl Into<String>, event: impl Into<String>, handler: F, ) -> Self
Create a task that waits for event, then runs handler.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Bound the wait for the event; on expiry the task fails with a timeout.
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set scheduling priority.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EventDrivenTask
impl !UnwindSafe for EventDrivenTask
impl Freeze for EventDrivenTask
impl Send for EventDrivenTask
impl Sync for EventDrivenTask
impl Unpin for EventDrivenTask
impl UnsafeUnpin for EventDrivenTask
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