pub struct PersistentColony { /* private fields */ }Expand description
A Colony with optional SQLite persistence.
Wraps a standard Colony and provides automatic loading/saving of the knowledge graph to SQLite.
Implementations§
Source§impl PersistentColony
impl PersistentColony
Sourcepub fn colony_mut(&mut self) -> &mut Colony
pub fn colony_mut(&mut self) -> &mut Colony
Get a mutable reference to the inner colony.
Sourcepub fn into_inner(self) -> Colony
pub fn into_inner(self) -> Colony
Consume self and return the inner colony.
Note: This will NOT trigger auto-save. Call save() first if needed.
Sourcepub fn has_persistence(&self) -> bool
pub fn has_persistence(&self) -> bool
Check if persistence is enabled.
pub fn save(&mut self) -> Result<(), BuilderError>
pub fn persistence_path(&self) -> Option<&Path>
Source§impl PersistentColony
impl PersistentColony
Sourcepub fn tick(&mut self) -> Vec<ColonyEvent>
pub fn tick(&mut self) -> Vec<ColonyEvent>
Run a single tick.
Sourcepub fn ingest_document(
&mut self,
title: &str,
content: &str,
position: Position,
) -> DocumentId
pub fn ingest_document( &mut self, title: &str, content: &str, position: Position, ) -> DocumentId
Ingest a document.
Sourcepub fn stats(&self) -> ColonyStats
pub fn stats(&self) -> ColonyStats
Get colony statistics.
Sourcepub fn snapshot(&self) -> ColonySnapshot
pub fn snapshot(&self) -> ColonySnapshot
Get a snapshot of the colony.
Sourcepub fn spawn(
&mut self,
agent: Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>,
) -> AgentId
pub fn spawn( &mut self, agent: Box<dyn Agent<Input = String, Fragment = String, Presentation = Vec<String>>>, ) -> AgentId
Spawn an agent.
Sourcepub fn alive_count(&self) -> usize
pub fn alive_count(&self) -> usize
Number of alive agents.
Auto Trait Implementations§
impl Freeze for PersistentColony
impl !RefUnwindSafe for PersistentColony
impl !Send for PersistentColony
impl !Sync for PersistentColony
impl Unpin for PersistentColony
impl !UnwindSafe for PersistentColony
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