Struct organelle::Organelle
[−]
[src]
pub struct Organelle<M, R> where
M: CellMessage,
R: CellRole, { /* fields omitted */ }
a special cell designed to contain a network of interconnected cells
the organelle is created with one cell. this cell is the only cell 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 cells hidden. upon receiving an update, it has the opportunity to communicate these updates with external cells.
the intent is to allow organelles to be hierarchical and potentially contain any number of nested cell 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 constraints can convert between each other using From and Into
Methods
impl<M, R> Organelle<M, R> where
M: CellMessage,
R: CellRole,
[src]
M: CellMessage,
R: CellRole,
fn new<L>(main: L) -> Self where
L: Cell<Message = M, Role = R> + 'static,
[src]
L: Cell<Message = M, Role = R> + 'static,
create a new organelle with input and output cells
fn add_cell<L>(&mut self, cell: L) -> Handle where
L: Cell + 'static,
M: From<L::Message> + Into<L::Message> + 'static,
L::Message: From<M> + Into<M> + 'static,
R: From<L::Role> + Into<L::Role> + Debug + Copy + Clone + Hash + Eq + PartialEq + 'static,
L::Role: From<R> + Into<R> + Debug + Copy + Clone + Hash + Eq + PartialEq + 'static,
[src]
L: Cell + 'static,
M: From<L::Message> + Into<L::Message> + 'static,
L::Message: From<M> + Into<M> + 'static,
R: From<L::Role> + Into<L::Role> + Debug + Copy + Clone + Hash + Eq + PartialEq + 'static,
L::Role: From<R> + Into<R> + Debug + Copy + Clone + Hash + Eq + PartialEq + 'static,
add a new cell to the organelle and initialize it
as long as the cell'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 cells that do the same.
fn connect(&mut self, input: Handle, output: Handle, role: R)
[src]
connect input to output and update them accordingly
fn get_main_handle(&self) -> Handle
[src]
get the main cell's handle
Trait Implementations
impl<M, R> Cell for Organelle<M, R> where
M: CellMessage,
R: CellRole,
[src]
M: CellMessage,
R: CellRole,