pub trait SendMany {
type Exec: MpcExecution<Msg = Self::Msg, SendErr = Self::SendErr>;
type Msg;
type SendErr;
// Required methods
async fn send(
&mut self,
msg: Outgoing<Self::Msg>,
) -> Result<(), Self::SendErr>;
async fn flush(self) -> Result<Self::Exec, Self::SendErr>;
// Provided methods
async fn send_p2p(
&mut self,
recipient: PartyIndex,
msg: Self::Msg,
) -> Result<(), Self::SendErr> { ... }
async fn send_to_all(&mut self, msg: Self::Msg) -> Result<(), Self::SendErr> { ... }
async fn reliably_broadcast(
&mut self,
msg: Self::Msg,
) -> Result<(), Self::SendErr> { ... }
}Expand description
Buffer, optimized for sending many messages at once
It’s obtained by calling MpcExecution::send_many, which takes ownership of MpcExecution. To reclaim
ownership, call SendMany::flush.
Required Associated Types§
Required Methods§
Sourceasync fn send(&mut self, msg: Outgoing<Self::Msg>) -> Result<(), Self::SendErr>
async fn send(&mut self, msg: Outgoing<Self::Msg>) -> Result<(), Self::SendErr>
Adds a message to the sending queue
Similar to MpcExecution::send, but possibly buffers a message until .flush() is
called.
A call to this function may send the message, but this is not guaranteed by the API. To
flush the sending queue and send all messages, use .flush().
Provided Methods§
Sourceasync fn send_p2p(
&mut self,
recipient: PartyIndex,
msg: Self::Msg,
) -> Result<(), Self::SendErr>
async fn send_p2p( &mut self, recipient: PartyIndex, msg: Self::Msg, ) -> Result<(), Self::SendErr>
Adds a p2p message to the sending queue
Similar to MpcExecution::send_p2p, but possibly buffers a message until .flush() is
called.
A call to this function may send the message, but this is not guaranteed by the API. To
flush the sending queue and send all messages, use .flush().
Sourceasync fn send_to_all(&mut self, msg: Self::Msg) -> Result<(), Self::SendErr>
async fn send_to_all(&mut self, msg: Self::Msg) -> Result<(), Self::SendErr>
Adds a broadcast message to the sending queue
Similar to MpcExecution::send_to_all, but possibly buffers a message until .flush() is
called.
A call to this function may send the message, but this is not guaranteed by the API. To
flush the sending queue and send all messages, use .flush().
Sourceasync fn reliably_broadcast(
&mut self,
msg: Self::Msg,
) -> Result<(), Self::SendErr>
async fn reliably_broadcast( &mut self, msg: Self::Msg, ) -> Result<(), Self::SendErr>
Adds a reliable broadcast message to the sending queue
Similar to MpcExecution::reliably_broadcast, but possibly buffers a message until .flush() is
called.
A call to this function may send the message, but this is not guaranteed by the API. To
flush the sending queue and send all messages, use Self::flush
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl<D, M, MainMsg> SendMany for WithEchoBroadcast<D, M, MainMsg>where
D: Digest + 'static,
M: SendMany<Msg = Msg<D, MainMsg>>,
MainMsg: ProtocolMsg + Digestable + Clone + 'static,
Available on crate feature echo-broadcast only.
impl<D, M, MainMsg> SendMany for WithEchoBroadcast<D, M, MainMsg>where
D: Digest + 'static,
M: SendMany<Msg = Msg<D, MainMsg>>,
MainMsg: ProtocolMsg + Digestable + Clone + 'static,
echo-broadcast only.