pub struct AsyncWriteConverse<W: AsyncWrite + Unpin, T: Serialize + DeserializeOwned + Unpin> { /* private fields */ }
Expand description

Used to send messages to the connected peer. You may optionally receive replies to your messages as well.

You must drive the corresponding AsyncReadConverse in order to receive replies to your messages. You can do this either by driving the Stream implementation, or calling AsyncReadConverse::drive_forever.

Implementations§

AsyncWriteConverse keeps a memory buffer for sending values which is the same size as the largest message that’s been sent. If the message size varies a lot, you might find yourself wasting memory space. This function will reduce the memory usage as much as is possible without impeding functioning. Overuse of this function may cause excessive memory allocations when the buffer needs to grow.

Send a message, and wait for a reply, with the default timeout. Shorthand for .awaiting both layers of .send(message).

Send a message, and wait for a reply, up to timeout. Shorthand for .awaiting both layers of .send_timeout(message).

Sends a message to the peer on the other side of the connection. This returns a future wrapped in a future. You must .await the first layer to send the message, however .awaiting the second layer is optional. You only need to .await the second layer if you care about the reply to your message. Waits up to the default timeout for a reply.

Sends a message to the peer on the other side of the connection, waiting up to the specified timeout for a reply. This returns a future wrapped in a future. You must .await the first layer to send the message, however .awaiting the second layer is optional. You only need to .await the second layer if you care about the reply to your message.

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.