willdo 0.0.1

Task manager with DAG
Documentation
//! Default Commander implementation is used when no interpretter is set up

use crate::execution::{
    commander::{Commander, Instance},
    progress::Observation,
    BoxError, BoxFuture, BoxInstance, BoxStream,
};
use futures_lite::stream::once;

/// Default no-op commander
/// You can dry ryn the graph with it. It produces a failure on any script as it doesn't know how to run scripts.
impl Commander for () {
    /// Starts a no-op instance
    fn start(&self) -> Result<BoxInstance, BoxError> {
        Ok(Box::new(()))
    }
}
/// Default no-op commander instance
/// You can dry ryn the graph with it. It produces a failure on any script as it doesn't know how to run scripts.
impl Instance for () {
    /// Succeeds
    fn shutdown(&mut self) -> BoxFuture<Result<BoxStream<Observation>, BoxError>> {
        Box::pin(
            async move { Ok(Box::pin(once(Observation::Completed(0))) as BoxStream<Observation>) },
        )
    }
    /// Produces a failure
    fn execute(
        &mut self,
        _command: &str,
    ) -> BoxFuture<Result<BoxStream<Observation>, BoxError>> {
        Box::pin(async move {
            Ok(Box::pin(once(Observation::Failure {
                message: "No interpretter".into(),
                source: None,
            })) as BoxStream<Observation>)
        })
    }
}