chaos_sdk/contexts/
interfaces.rs

1/*
2    Appellation: interfaces
3    Context:
4    Creator: FL03 <jo3mccain@icloud.com>
5    Description:
6        ... Summary ...
7 */
8
9pub trait Conduit {
10    type Actor;
11    type Client;
12    type Config;
13    type Data;
14
15    fn actor(&self, actions: Self::Data) -> Self::Actor;
16    fn client(&self) -> Result<Self::Client, Box<dyn std::error::Error + Send + Sync + 'static>>;
17    fn configure(&self, configuration: Self::Config) -> Result<Self::Config, config::ConfigError>;
18    fn determine(&self, data: Self::Data) -> Self::Data;
19}
20
21pub trait CommandLineInterface {
22    type Args;
23
24    fn client(&self) -> Self::Args;
25}
26
27#[cfg(test)]
28mod tests {
29    #[test]
30    fn simple() {
31        let f = |x: usize| x.pow(x.try_into().unwrap());
32        assert_eq!(f(2), 4)
33    }
34}