pub struct Channels { /* private fields */ }Expand description
The communication channels for one party. These also keep track of how many bytes are sent.
Implementations§
Source§impl Channels
impl Channels
Sourcepub fn new(
id: usize,
senders: Vec<Sender<Message>>,
receiver: Receiver<Message>,
latency: Duration,
seconds_per_byte: Duration,
) -> Self
pub fn new( id: usize, senders: Vec<Sender<Message>>, receiver: Receiver<Message>, latency: Duration, seconds_per_byte: Duration, ) -> Self
Contructs a new channel with communication overhead.
Sourcepub fn receive(&mut self, from_id: &usize) -> DelayedByteIterator ⓘ
pub fn receive(&mut self, from_id: &usize) -> DelayedByteIterator ⓘ
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.
The simulated delays are planned in such a way that they mimick the given bandwidth and latency constraints in the case where messages are scheduled optimally.
Auto Trait Implementations§
impl Freeze for Channels
impl RefUnwindSafe for Channels
impl Send for Channels
impl !Sync for Channels
impl Unpin for Channels
impl UnwindSafe for Channels
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> 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