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
lightway-core: io: Add a CoW abstraction for sending buffer
Depending on the specific implementation of the trait they may or may not need
an owned version of the buffer. Since we have one already in the core in some
paths we can expose that through the stack and avoid some extra allocations.
In the UDP send path we can easily and cheaply freeze the `BytesMut` buffer to
get an owned `Bytes` (with a little more overhead while `aggressive_send` is
enabled). However in the TCP path the use of `SendBuffer` makes this harder (if
not impossible) to achieve (cheaply at least).
So add `CowBytes` which can contain either a `Bytes` or a `&[u8]` slice.
Note that right now every consumer still uses the byte slice.
0 commit comments