pub struct Event<O: Clone> {
pub kind: EventKind,
pub task_id: Uuid,
pub worker_id: String,
pub progress: Option<Progress>,
pub data: Option<O>,
pub error: Option<String>,
pub timestamp: DateTime<Utc>,
}Expand description
Event emitted by a worker task on the event channel.
Fields§
§kind: EventKindThe kind of this event.
task_id: UuidIdentifier of the task that produced this event.
worker_id: StringIdentifier of the worker that produced this event.
progress: Option<Progress>Progress snapshot, present for EventKind::Progress events.
data: Option<O>Task output payload, present for Partial and Result events.
error: Option<String>Error or log message, present for Error and Log events.
timestamp: DateTime<Utc>Wall-clock time at which the event was created.
Implementations§
Source§impl<O: Clone> Event<O>
impl<O: Clone> Event<O>
Sourcepub fn progress(
task_id: Uuid,
worker_id: impl Into<String>,
p: Progress,
) -> Self
pub fn progress( task_id: Uuid, worker_id: impl Into<String>, p: Progress, ) -> Self
Create a progress event carrying the given Progress snapshot.
Sourcepub fn partial(task_id: Uuid, worker_id: impl Into<String>, data: O) -> Self
pub fn partial(task_id: Uuid, worker_id: impl Into<String>, data: O) -> Self
Create a partial-result event carrying an intermediate output value.
Sourcepub fn log(
task_id: Uuid,
worker_id: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn log( task_id: Uuid, worker_id: impl Into<String>, message: impl Into<String>, ) -> Self
Create a log event carrying a free-form text message.
Trait Implementations§
Auto Trait Implementations§
impl<O> Freeze for Event<O>where
O: Freeze,
impl<O> RefUnwindSafe for Event<O>where
O: RefUnwindSafe,
impl<O> Send for Event<O>where
O: Send,
impl<O> Sync for Event<O>where
O: Sync,
impl<O> Unpin for Event<O>where
O: Unpin,
impl<O> UnsafeUnpin for Event<O>where
O: UnsafeUnpin,
impl<O> UnwindSafe for Event<O>where
O: UnwindSafe,
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