pub struct RoundContext<'a, D = ()> { /* private fields */ }
Expand description
Context provided during each simulation round.
Contains information about the current round, this node’s identity, the shared setup data, and the addresses of all participating nodes.
Implementations§
Source§impl<'a, D> RoundContext<'a, D>
impl<'a, D> RoundContext<'a, D>
Sourcepub fn node_index(&self) -> u32
pub fn node_index(&self) -> u32
Returns the index of this node in the simulation.
Sourcepub fn setup_data(&self) -> &D
pub fn setup_data(&self) -> &D
Returns a reference to the shared setup data for this simulation.
Sourcepub fn all_other_nodes(
&self,
me: NodeId,
) -> impl Iterator<Item = &NodeAddr> + '_
pub fn all_other_nodes( &self, me: NodeId, ) -> impl Iterator<Item = &NodeAddr> + '_
Returns an iterator over the addresses of all nodes except the specified one.
Sourcepub fn addr(&self, idx: u32) -> Result<NodeAddr>
pub fn addr(&self, idx: u32) -> Result<NodeAddr>
Returns the address of the node with the given index.
§Errors
Returns an error if no node with the specified index exists.
pub fn try_self_addr(&self) -> Result<&NodeAddr>
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the total number of nodes participating in the simulation.
Auto Trait Implementations§
impl<'a, D> Freeze for RoundContext<'a, D>
impl<'a, D> RefUnwindSafe for RoundContext<'a, D>where
D: RefUnwindSafe,
impl<'a, D> Send for RoundContext<'a, D>where
D: Sync,
impl<'a, D> Sync for RoundContext<'a, D>where
D: Sync,
impl<'a, D> Unpin for RoundContext<'a, D>
impl<'a, D> UnwindSafe for RoundContext<'a, D>where
D: RefUnwindSafe,
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