Skip to main content

gmt_dos_actors/system/
interfaces.rs

1use std::fmt::Display;
2
3use crate::{
4    actor::{Actor, PlainActor},
5    prelude::GetName,
6};
7
8use super::SystemError;
9
10/// System interface
11pub trait System: Sized + Clone + Display + Send + Sync + GetName {
12    fn name(&self) -> String {
13        String::from("SYSTEM")
14    }
15    fn build(&mut self) -> Result<&mut Self, SystemError> {
16        Ok(self)
17    }
18    fn plain(&self) -> PlainActor;
19}
20
21/// System inputs interface
22pub trait SystemInput<C, const NI: usize, const NO: usize>
23where
24    C: interface::TryUpdate,
25{
26    fn input(&mut self) -> &mut Actor<C, NI, NO>;
27}
28
29/// System outputs interface
30pub trait SystemOutput<C, const NI: usize, const NO: usize>
31where
32    C: interface::TryUpdate,
33{
34    fn output(&mut self) -> &mut Actor<C, NI, NO>;
35}