taktora-executor 0.1.0

Execution framework for iceoryx2-based Rust applications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `ExecutionMonitor` — pre/post `execute` timestamps.

use crate::task_id::TaskId;
use core::time::Duration;
use std::time::Instant;

/// Hook invoked before and after every `execute` call. Defaults are no-ops.
pub trait ExecutionMonitor: Send + Sync {
    /// Called immediately before an item's `execute()` is invoked.
    fn pre_execute(&self, _task: TaskId, _at: Instant) {}
    /// Called immediately after `execute()` returns. `ok` is `false` if the
    /// item returned `Err` (or panicked).
    fn post_execute(&self, _task: TaskId, _at: Instant, _took: Duration, _ok: bool) {}
}

/// No-op monitor used when the user does not configure one.
pub struct NoopMonitor;
impl ExecutionMonitor for NoopMonitor {}