pub struct SubstrateImpl { /* private fields */ }Expand description
In-memory substrate implementation.
The substrate is the extracellular matrix — the shared environment all agents sense and modify. It holds signals (for chemotaxis), a knowledge graph (for stigmergy and Hebbian wiring), and traces (for indirect coordination).
Implementations§
Source§impl SubstrateImpl
impl SubstrateImpl
pub fn new() -> Self
Sourcepub fn get_document(&self, id: &DocumentId) -> Option<&Document>
pub fn get_document(&self, id: &DocumentId) -> Option<&Document>
Get a document by ID (convenience method bypassing trait).
Sourcepub fn all_documents(&self) -> Vec<&Document>
pub fn all_documents(&self) -> Vec<&Document>
Get all documents (convenience method).
Sourcepub fn graph(&self) -> &PetTopologyGraph
pub fn graph(&self) -> &PetTopologyGraph
Get a reference to the underlying topology graph.
Sourcepub fn graph_mut(&mut self) -> &mut PetTopologyGraph
pub fn graph_mut(&mut self) -> &mut PetTopologyGraph
Get a mutable reference to the underlying topology graph.
Sourcepub fn all_signals(&self) -> &[Signal]
pub fn all_signals(&self) -> &[Signal]
Get all signals (for diagnostics/visualization).
Sourcepub fn total_trace_count(&self) -> usize
pub fn total_trace_count(&self) -> usize
Total number of traces across all locations.
Trait Implementations§
Source§impl Default for SubstrateImpl
impl Default for SubstrateImpl
Source§impl Substrate for SubstrateImpl
impl Substrate for SubstrateImpl
Source§fn signals_near(&self, position: &Position, radius: f64) -> Vec<&Signal>
fn signals_near(&self, position: &Position, radius: f64) -> Vec<&Signal>
Read all signals within a radius of a position.
Source§fn emit_signal(&mut self, signal: Signal)
fn emit_signal(&mut self, signal: Signal)
Emit a signal into the substrate.
Source§fn decay_signals(&mut self, rate: f64, removal_threshold: f64)
fn decay_signals(&mut self, rate: f64, removal_threshold: f64)
Decay all signals by a rate (0.0-1.0). Signals below threshold are removed.
Source§fn set_edge(&mut self, from: NodeId, to: NodeId, data: EdgeData)
fn set_edge(&mut self, from: NodeId, to: NodeId, data: EdgeData)
Add or update an edge between two nodes.
Source§fn get_edge(&self, from: &NodeId, to: &NodeId) -> Option<&EdgeData>
fn get_edge(&self, from: &NodeId, to: &NodeId) -> Option<&EdgeData>
Get edge data between two nodes.
Source§fn neighbors(&self, node: &NodeId) -> Vec<(NodeId, &EdgeData)>
fn neighbors(&self, node: &NodeId) -> Vec<(NodeId, &EdgeData)>
Get all neighbors of a node with their edge data.
Source§fn remove_edge(&mut self, from: &NodeId, to: &NodeId)
fn remove_edge(&mut self, from: &NodeId, to: &NodeId)
Remove an edge.
Source§fn all_edges(&self) -> Vec<(NodeId, NodeId, &EdgeData)>
fn all_edges(&self) -> Vec<(NodeId, NodeId, &EdgeData)>
Get all edges as (from, to, data) triples.
Source§fn node_count(&self) -> usize
fn node_count(&self) -> usize
Number of nodes in the graph.
Source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Number of edges in the graph.
Source§fn deposit_trace(&mut self, location: &SubstrateLocation, trace: Trace)
fn deposit_trace(&mut self, location: &SubstrateLocation, trace: Trace)
Deposit a trace at a location.
Source§fn decay_traces(&mut self, rate: f64, removal_threshold: f64)
fn decay_traces(&mut self, rate: f64, removal_threshold: f64)
Decay all traces by a rate. Traces below threshold are removed.
Source§fn add_document(&mut self, doc: Document)
fn add_document(&mut self, doc: Document)
Place a document in the substrate.
Source§fn get_document(&self, id: &DocumentId) -> Option<&Document>
fn get_document(&self, id: &DocumentId) -> Option<&Document>
Get a document by ID.
Source§fn undigested_documents(&self) -> Vec<&Document>
fn undigested_documents(&self) -> Vec<&Document>
Get all undigested documents.
Source§fn consume_document(&mut self, id: &DocumentId) -> Option<String>
fn consume_document(&mut self, id: &DocumentId) -> Option<String>
Mark a document as digested and return its content.
Source§fn all_documents(&self) -> Vec<&Document>
fn all_documents(&self) -> Vec<&Document>
Get all documents.
Source§fn current_tick(&self) -> Tick
fn current_tick(&self) -> Tick
Current simulation tick.
Source§fn advance_tick(&mut self)
fn advance_tick(&mut self)
Advance the tick counter.
Auto Trait Implementations§
impl Freeze for SubstrateImpl
impl RefUnwindSafe for SubstrateImpl
impl Send for SubstrateImpl
impl Sync for SubstrateImpl
impl Unpin for SubstrateImpl
impl UnwindSafe for SubstrateImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more