Struct h2::PingPong

source · []
pub struct PingPong { /* private fields */ }
Expand description

A handle to send and receive PING frames with the peer.

Implementations

Send a PING frame to the peer.

Only one ping can be pending at a time, so trying to send while a pong has not be received means this will return a user error.

Example
// let mut ping_pong = ...
ping_pong
    .send_ping(h2::Ping::opaque())
    .unwrap();

Polls for the acknowledgement of a previously sent PING frame.

Example
// let mut ping_pong = ...

// First, send a PING.
ping_pong
    .send_ping(h2::Ping::opaque())
    .unwrap();

// And then wait for the PONG.
futures::future::poll_fn(move || {
    ping_pong.poll_pong()
}).wait().unwrap();

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.