Skip to main content

Digester

Struct Digester 

Source
pub struct Digester { /* private fields */ }
Expand description

A text-digesting agent — the computational macrophage.

Implementations§

Source§

impl Digester

Source

pub fn new(position: Position) -> Digester

Source

pub fn with_seed(position: Position, seed: u64) -> Digester

Create a digester with a deterministic ID (for testing).

Source

pub fn with_max_idle(self, max_idle: u64) -> Digester

Create a digester with custom idle threshold.

Source

pub fn total_fragments(&self) -> usize

Total fragments produced in lifetime.

Source

pub fn increment_idle(&mut self)

Simulate an idle tick (for testing/demo purposes).

Source

pub fn idle_ticks(&self) -> u64

Current idle tick count (for testing/inspection).

Source

pub fn set_idle_ticks(&mut self, ticks: u64)

Set idle ticks directly (for testing).

Source

pub fn digest_text(&mut self, text: String) -> Vec<String>

Direct digestion: feed text and get fragments back immediately. This is a convenience for testing — in a colony, agents get input via SENSE + ENGULF from the substrate.

Source

pub fn feed_document(&mut self, doc_id: DocumentId, content: String)

Feed document content to this agent (called by colony after EngulfDocument). Sets internal state so the next tick processes the content.

Trait Implementations§

Source§

impl Agent for Digester

Source§

fn id(&self) -> AgentId

The agent’s unique identity.
Source§

fn position(&self) -> Position

The agent’s current position in the substrate.
Source§

fn set_position(&mut self, position: Position)

Set the agent’s position.
Source§

fn agent_type(&self) -> &str

The agent’s type name (for display and logging).
Source§

fn tick(&mut self, substrate: &dyn Substrate) -> AgentAction

Execute one tick of the agent’s lifecycle. Read more
Source§

fn age(&self) -> u64

How many ticks this agent has been alive.
Source§

fn export_vocabulary(&self) -> Option<Vec<u8>>

Export this agent’s vocabulary as serialized bytes. Returns None if the agent has no vocabulary to export.
Source§

fn integrate_vocabulary(&mut self, data: &[u8]) -> bool

Integrate foreign vocabulary from serialized bytes. Returns true if integration succeeded.
Source§

fn profile(&self) -> AgentProfile

Build a profile describing this agent’s capabilities.
Source§

fn evaluate_symbiosis(&self, other: &AgentProfile) -> Option<SymbiosisEval>

Evaluate whether to absorb another agent as a symbiont.
Source§

fn absorb_symbiont(&mut self, profile: AgentProfile, data: Vec<u8>) -> bool

Absorb another agent’s profile and vocabulary data as a symbiont. Returns true if absorption succeeded.
Source§

fn permeability(&self) -> f64

Current boundary permeability (0.0 = rigid, 1.0 = fully dissolved).
Source§

fn modulate_boundary(&mut self, context: &BoundaryContext)

Adjust boundary permeability based on environmental context.
Source§

fn externalize_vocabulary(&self) -> Vec<String>

Return vocabulary terms to externalize (reinforce in the substrate).
Source§

fn internalize_vocabulary(&mut self, terms: &[String])

Absorb nearby concept terms from the substrate.
Source§

fn vocabulary_size(&self) -> usize

Return the size of this agent’s vocabulary (for metrics).
Source§

impl Apoptose for Digester

Source§

fn self_assess(&self) -> CellHealth

Evaluate own health and usefulness. Read more
Source§

fn prepare_death_signal(&self) -> DeathSignal

Package final state into a death signal before destruction. Read more
Source§

fn should_die(&self) -> bool

Whether the agent should initiate death. Read more
Source§

fn trigger_apoptosis(self) -> DeathSignal
where Self: Sized,

Initiate orderly self-destruction (for concrete types). Read more
Source§

impl Digest for Digester

Source§

type Input = String

The raw input to consume. Ownership is transferred — the input is destroyed.
Source§

type Fragment = String

Structural fragments extracted during digestion.
Source§

type Presentation = Vec<String>

What is presented to other agents after digestion.
Source§

fn engulf(&mut self, input: String) -> DigestionResult

Engulf: take ownership of input. Read more
Source§

fn lyse(&mut self) -> Vec<String>

Lyse: break the engulfed material into fragments. Read more
Source§

fn present(&self) -> Vec<String>

Present: expose fragments on the agent’s surface. Read more
Source§

fn digest(&mut self, input: Self::Input) -> Self::Presentation

Run the full digestion cycle: engulf → lyse → present.
Source§

impl Sense for Digester

Source§

fn sense_radius(&self) -> f64

The radius within which this agent can sense signals.
Source§

fn sense_position(&self) -> Position

The position from which this agent senses.
Source§

fn gradient(&self, substrate: &dyn Substrate) -> Vec<Gradient>

Compute the gradient — direction of increasing signal strength. Read more
Source§

fn orient(&self, gradients: &[Gradient]) -> Orientation

Determine next orientation based on sensed gradients. Read more
Source§

fn sense(&self, substrate: &dyn Substrate) -> Vec<Signal>

Read signals from the local environment. Read more
Source§

fn emit(&self, signal: Signal, substrate: &mut dyn Substrate)

Emit a signal into the substrate. Read more
Source§

impl SerializableAgent for Digester

Source§

fn export_state(&self) -> SerializedAgent

Export the agent’s state for serialization.
Source§

fn from_state(state: &SerializedAgent) -> Option<Digester>

Create an agent from serialized state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.