pub struct RelayNetwork { /* private fields */ }Implementations§
Source§impl RelayNetwork
impl RelayNetwork
pub fn new() -> Self
pub fn with_config( hop_cost: f32, nutrient_per_hop: f32, trust_boost: f32, trust_degrade: f32, trust_halflife_secs: u64, ) -> Self
pub fn add_agent(&mut self, id: AgentId, energy: f32)
pub fn remove_agent(&mut self, id: AgentId)
pub fn agent(&self, id: AgentId) -> Option<&Agent>
pub fn agent_count(&self) -> usize
pub fn alive_agents(&self) -> Vec<AgentId> ⓘ
pub fn set_trust(&mut self, from: AgentId, to: AgentId, level: f32)
pub fn trust(&self, from: AgentId, to: AgentId) -> f32
pub fn boost_trust(&mut self, from: AgentId, to: AgentId)
pub fn degrade_trust(&mut self, from: AgentId, to: AgentId)
Sourcepub fn decay_all_trust(&mut self, elapsed_secs: u64)
pub fn decay_all_trust(&mut self, elapsed_secs: u64)
Apply time-based trust decay (halflife model)
Sourcepub fn find_path(
&self,
from: AgentId,
to: AgentId,
max_hops: u32,
) -> Option<Vec<AgentId>>
pub fn find_path( &self, from: AgentId, to: AgentId, max_hops: u32, ) -> Option<Vec<AgentId>>
Find best path using BFS with trust-weighted edges. Returns path as list of agent IDs (including source and destination).
Sourcepub fn send(&mut self, msg: Message) -> DeliveryResult
pub fn send(&mut self, msg: Message) -> DeliveryResult
Send a message through the relay network.
Sourcepub fn spore_probe(&self, source: AgentId, max_hops: u32) -> Vec<AgentId> ⓘ
pub fn spore_probe(&self, source: AgentId, max_hops: u32) -> Vec<AgentId> ⓘ
Broadcast a probe to discover new routes. Returns all reachable agents from source.
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Count active trust connections (edges with trust > 0)
Sourcepub fn average_trust(&self) -> f32
pub fn average_trust(&self) -> f32
Average trust across all connections
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RelayNetwork
impl RefUnwindSafe for RelayNetwork
impl Send for RelayNetwork
impl Sync for RelayNetwork
impl Unpin for RelayNetwork
impl UnsafeUnpin for RelayNetwork
impl UnwindSafe for RelayNetwork
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