pub trait PingDelegate:
Send
+ Sync
+ 'static {
type Id: Id;
type Address: CheapClone + Send + Sync + 'static;
// Required methods
fn ack_payload(&self) -> impl Future<Output = Bytes> + Send;
fn notify_ping_complete(
&self,
node: Arc<NodeState<Self::Id, Self::Address>>,
rtt: Duration,
payload: Bytes,
) -> impl Future<Output = ()> + Send;
// Provided method
fn disable_reliable_pings(&self, _target: &Self::Id) -> bool { ... }
}Expand description
Used to notify an observer how long it took for a ping message to complete a round trip. It can also be used for writing arbitrary byte slices into ack messages. Note that in order to be meaningful for RTT estimates, this delegate does not apply to indirect pings, nor fallback pings sent over promised connection.
Required Associated Types§
Sourcetype Address: CheapClone + Send + Sync + 'static
type Address: CheapClone + Send + Sync + 'static
The address type of the delegate
Required Methods§
Sourcefn ack_payload(&self) -> impl Future<Output = Bytes> + Send
fn ack_payload(&self) -> impl Future<Output = Bytes> + Send
Invoked when an ack is being sent; the returned bytes will be appended to the ack
Provided Methods§
Sourcefn disable_reliable_pings(&self, _target: &Self::Id) -> bool
fn disable_reliable_pings(&self, _target: &Self::Id) -> bool
Invoked when we want to send a ping message to target by promised connection. Return true if the target node does not expect ping message from promised connection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".