pub struct VirtualSwarm { /* private fields */ }Expand description
A virtual swarm of simulated peers
Implementations§
Source§impl VirtualSwarm
impl VirtualSwarm
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get the number of peers
Sourcepub fn peer(&self, index: usize) -> Option<&VirtualPeer>
pub fn peer(&self, index: usize) -> Option<&VirtualPeer>
Get a reference to a specific peer
Sourcepub fn peer_mut(&mut self, index: usize) -> Option<&mut VirtualPeer>
pub fn peer_mut(&mut self, index: usize) -> Option<&mut VirtualPeer>
Get a mutable reference to a specific peer
Sourcepub fn bootstrap(&mut self, connections_per_peer: usize)
pub fn bootstrap(&mut self, connections_per_peer: usize)
Bootstrap the swarm: each peer learns about some neighbors
Sourcepub fn avg_routing_table_size(&self) -> f64
pub fn avg_routing_table_size(&self) -> f64
Get average routing table size across all peers
Auto Trait Implementations§
impl Freeze for VirtualSwarm
impl RefUnwindSafe for VirtualSwarm
impl Send for VirtualSwarm
impl Sync for VirtualSwarm
impl Unpin for VirtualSwarm
impl UnsafeUnpin for VirtualSwarm
impl UnwindSafe for VirtualSwarm
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more