wtransport
wtransport copied to clipboard
Make receive_datagram return BytesMut
Some use cases, such as using datagrams with serde via tokio_serde::Framed
, require that messages received from the peer are BytesMut
instead of Bytes
. Currently, Connection::receive_datagram()
returns a Datagram
which itself can only give you Bytes
, so the user of the API first needs to clone the data to get exclusive access to a buffer.
It would be nice if receive_datagrams
instead returned a BytesMut
, providing more performance for use cases like mine where I actually need exclusive access to the buffer.