You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
AFAIK, no, there isn't a way. There is a is_unique function, but I don't think it can be used for the purpose of converting to a BytesMut. I could be wrong though.
I am afraid so. Considering the QUIC connection returns a datagram as Byteshere, the only possibility is to copy the data (even if the Bytes is unique), I guess
Some use cases, such as using datagrams with serde via
tokio_serde::Framed
, require that messages received from the peer areBytesMut
instead ofBytes
. Currently,Connection::receive_datagram()
returns aDatagram
which itself can only give youBytes
, 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 aBytesMut
, providing more performance for use cases like mine where I actually need exclusive access to the buffer.The text was updated successfully, but these errors were encountered: