pub struct Network<M> { /* private fields */ }Available on crate features
sim and sim-async only.Expand description
Simulated async network
Implementations§
Source§impl<M> Network<M>
impl<M> Network<M>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Instantiates a new simulation with given capacity
Simulation stores internally all sent messages. Capacity limits size of the internal buffer.
Because of that you might run into error if you choose too small capacity. Choose capacity
that can fit all the messages sent by all the parties during entire protocol lifetime.
Default capacity is 500 (i.e. if you call Simulation::new())
Sourcepub fn add_party(&mut self) -> MpcParty<M, MockedDelivery<M>>
pub fn add_party(&mut self) -> MpcParty<M, MockedDelivery<M>>
Adds new party to the network
Sourcepub fn connect_new_party(&mut self) -> MockedDelivery<M>
pub fn connect_new_party(&mut self) -> MockedDelivery<M>
Connects new party to the network
Similar to .add_party() but returns MockedDelivery<M> instead of
MpcParty<M, MockedDelivery<M>>
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for Network<M>
impl<M> RefUnwindSafe for Network<M>
impl<M> Send for Network<M>where
M: Send,
impl<M> Sync for Network<M>where
M: Send,
impl<M> Unpin for Network<M>
impl<M> UnwindSafe for Network<M>
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