Struct organelle::Organelle
[−]
[src]
pub struct Organelle<S: Soma + 'static> { /* fields omitted */ }
a special soma designed to contain a network of interconnected somas
the organelle is created with one soma. this soma is the only soma within the organelle that is allowed to communicate or connect to the outside world. it acts as an entry point for the network, providing essential external data while keeping implementation-specific data and somas hidden. upon receiving an update, it has the opportunity to communicate these updates with external somas.
the intent is to allow organelles to be hierarchical and potentially contain any number of nested soma networks. in order to do this, the organelle isolates a group of messages from the larger whole. this is essential for extensibility and maintainability.
any organelle can be plugged into any other organelle provided their messages and dendrites can convert between each other using From and Into
Methods
impl<S: Soma + 'static> Organelle<S>
[src]
fn new(main: S) -> Self
[src]
create a new organelle with input and output somas
fn add_soma<T>(&mut self, soma: T) -> Handle where
T: Soma + 'static,
S::Signal: From<T::Signal> + Into<T::Signal> + Signal,
T::Signal: From<S::Signal> + Into<S::Signal> + Signal,
S::Synapse: From<T::Synapse> + Into<T::Synapse> + Synapse,
T::Synapse: From<S::Synapse> + Into<S::Synapse> + Synapse,
[src]
T: Soma + 'static,
S::Signal: From<T::Signal> + Into<T::Signal> + Signal,
T::Signal: From<S::Signal> + Into<S::Signal> + Signal,
S::Synapse: From<T::Synapse> + Into<T::Synapse> + Synapse,
T::Synapse: From<S::Synapse> + Into<S::Synapse> + Synapse,
add a new soma to the organelle and initialize it
as long as the soma's message type can convert Into and From the organelle's message type, it can be added to the organelle and can communicate with any somas that do the same.
fn connect(&mut self, input: Handle, output: Handle, role: S::Synapse)
[src]
connect input to output and update them accordingly
fn get_main_handle(&self) -> Handle
[src]
get the main soma's handle
Trait Implementations
impl<S: Soma> Soma for Organelle<S>
[src]
type Signal = S::Signal
user-defined message to be passed between somas
type Synapse = S::Synapse
user-defined roles for connections
type Error = S::Error
error when a soma fails to update
fn update(
self,
msg: Impulse<S::Signal, S::Synapse>
) -> Result<Self, Self::Error>
[src]
self,
msg: Impulse<S::Signal, S::Synapse>
) -> Result<Self, Self::Error>
apply any changes to the soma's state as a result of _msg
fn into_future(
self,
reactor: Handle
) -> Box<Future<Item = Result<()>, Error = Error>> where
Self: 'static,
[src]
self,
reactor: Handle
) -> Box<Future<Item = Result<()>, Error = Error>> where
Self: 'static,
convert the soma into a future that can be run on an event loop
fn run(self) -> Result<()> where
Self: 'static,
[src]
Self: 'static,
spin up an event loop and run soma