roplat 0.1.0

roplat: just a robot operation system
Documentation
mod event_trigger;
mod sys_timer;

use std::fmt::Debug;

pub use event_trigger::*;
pub use sys_timer::*;

use futures::future::BoxFuture;

use crate::RoplatError;

#[async_trait::async_trait]
pub trait Rhythm {
    type Yield;
    type Feed;

    type Output;
    type Error: Into<RoplatError> + Debug;

    async fn drive<N, F>(&mut self, mut nodes: N, op_domain: F) -> Self::Output
    where
        N: Send + Sync,
        F: for<'a> FnMut(&'a mut N, Self::Yield) -> BoxFuture<'a, Self::Feed> + Send;
    async fn init<N, F>(&mut self, _nodes: N, _init: F) -> Result<(), Self::Error>
    where
        N: Send,
        F: FnMut() + Send,
    {
        Ok(())
    }
    async fn shutdown<N, F>(&mut self, _nodes: N, _shutdown: F) -> Result<(), Self::Error>
    where
        N: Send,
        F: for<'a> FnMut(&'a mut N) + Send,
    {
        Ok(())
    }
}