Skip to content

BufWriter should buffer up to its capacity #72919

Closed
@Lucretiel

Description

@Lucretiel

if buf.len() >= self.buf.capacity() {

Suppose you had a BufWriter with capacity 4. If you write b"1234" to it, that will be flushed directly to the underlying stream, but if you write b"12" and then b"34", those will be buffered. The unit tests confirm this behavior, but it seems surprising to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions