pub use helpers::{spawn_supervised, spawn_supervised_many};
pub use core::TaskRuntime;
pub use types::{PrerequisiteFuture, SupervisionResult, TaskEntry};
mod helpers;
mod core;
mod supervision;
mod types;
mod validation;
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_basic_supervision() {
use crate::contracts::SupervisedTask;
struct TestTask;
#[async_trait::async_trait]
impl SupervisedTask for TestTask {
fn id(&self) -> &'static str { "test" }
async fn run(&self) -> anyhow::Result<()> { Ok(()) }
}
let handle = spawn_supervised(TestTask);
let result = handle.await.unwrap();
assert_eq!(result.final_status, crate::enums::SupervisionStatus::CompletedNormally);
}
}