CheckedSender

Trait CheckedSender 

Source
pub trait CheckedSender: Send {
    type PublicKey: PublicKey;
    type Error: Debug + StdError + Send + Sync + 'static;

    // Required method
    fn send(
        self,
        message: impl Buf + Send,
        priority: bool,
    ) -> impl Future<Output = Result<Vec<Self::PublicKey>, Self::Error>> + Send;
}
Expand description

Interface for sending messages to Recipients that are not currently rate-limited.

Required Associated Types§

Source

type PublicKey: PublicKey

Public key type used to identify Recipients.

Source

type Error: Debug + StdError + Send + Sync + 'static

Error that can occur when sending a message.

Required Methods§

Source

fn send( self, message: impl Buf + Send, priority: bool, ) -> impl Future<Output = Result<Vec<Self::PublicKey>, Self::Error>> + Send

Sends a message to the pre-checked recipients.

§Offline Recipients

If a recipient is offline at the time a message is sent, the message will be dropped. It is up to the application to handle retries (if necessary).

§Returns

A vector of recipients that the message was sent to, or an error if the message could not be sent due to a validation failure (e.g., too large).

Note: a successful send does not guarantee that the recipient will receive the message.

§Graceful Shutdown

Implementations must handle internal channel closures gracefully during shutdown. If the underlying network is shutting down, this method should return Ok (possibly with an empty or partial recipient list) rather than an error. Errors should only be returned for validation failures that the caller can act upon.

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§