eryon_actors/drivers/
mod.rs1#[doc(inline)]
8pub use self::plant::Plant;
9
10mod plant;
11
12pub(crate) mod prelude {
13 pub use super::plant::Plant;
14 pub use super::{Driver, RawDriver, TriadDriver};
15 pub use super::{NeuralPlant, WolframPlant};
16}
17
18use crate::engine::RawEngine;
19use crate::nrt::{LPR, Triad};
20
21pub type NeuralPlant<T = f32> = Plant<crate::engine::NeuralEngine<T>>;
23pub type WolframPlant<Q = usize, S = usize> = Plant<crate::engine::WolframUTM<Q, S>>;
25
26pub trait RawDriver<C>: Send + Sync + core::fmt::Debug {
30 type Engine: RawEngine;
31
32 fn engine(&self) -> &Self::Engine;
33
34 fn engine_mut(&mut self) -> &mut Self::Engine;
35
36 fn headspace(&self) -> &C;
37
38 fn headspace_mut(&mut self) -> &mut C;
39
40 private!();
41}
42
43pub trait Driver<H>: RawDriver<H>
49where
50 Self: Clone + Default,
51{
52 fn from_headspace(headspace: H) -> Self;
54}
55
56pub trait TriadDriver: Driver<Triad> {
58 fn transform(&mut self, transform: LPR) -> Result<(), crate::ActorError>;
59
60 fn walk<'a, I>(&mut self, iter: I) -> Result<(), crate::ActorError>
61 where
62 I: IntoIterator<Item = &'a LPR>;
63}