pub struct Party { /* private fields */ }
Expand description
A Party
that takes part in a protocol. The party has a unique id
and is pre-loaded with
communication channels to and from all the other parties. A party keeps track of its own stats.
Implementations
sourceimpl Party
impl Party
sourcepub fn receive(&mut self, from_id: &usize) -> Vec<u8>
pub fn receive(&mut self, from_id: &usize) -> Vec<u8>
Blocks until this party receives a message from the party with from_id
. A message is a
vector of bytes Vec<u8>
. This can be achieved for example using bincode
serialization.
sourceimpl Party
impl Party
sourcepub fn create_timer(&self, name: &str) -> Timer
pub fn create_timer(&self, name: &str) -> Timer
Creates a timer with the given name
that starts running immediately.
sourcepub fn stop_timer(&mut self, timer: Timer)
pub fn stop_timer(&mut self, timer: Timer)
Stops the timer
and writes it measured duration to this party’s statistics.
Auto Trait Implementations
impl !RefUnwindSafe for Party
impl Send for Party
impl !Sync for Party
impl Unpin for Party
impl !UnwindSafe for Party
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more