Skip to content

BytesMut::advance no longer advances cursor #725

Closed
@camshaft

Description

@camshaft

In #698, the behavior of BytesMut::advance was changed to clear the buffer instead of reduce capacity when the advanced count matched remaining. In s2n-quic, we rely on advance actually reducing remaining and have several data structures and trait impls that rely on this behavior:

In its current state, there's no longer an efficient way to actually reduce capacity of BytesMut, since the only other option is to call split_to and discard the result, which isn't great since you churn on reference counts, which is kind of the whole point of advance, as indicated by the #[must_use] attribute: consider BytesMut::advance if you don't need the other half.

My vote would be to revert this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions