Skip to content

Do not flush underlying writer when buffer becomes full #173

Description

@owst

What version of the csv crate are you using?

master: fcdbea357739348b9eed2a0239e180213be78af9

Briefly describe the question, bug or feature request.

As mentioned in this issue of xsv, it seems that rust-csv is flushing the underlying writer when its internal buffer becomes full. This causes issues for xsv as the underlying writer is a TabWriter and calling flush causes side-effects other than writing out the buffer (specifically, it resets the internal state, "breaking" alignment of subsequently written data)

Include a complete program demonstrating a problem.

The reproduction with xsv is attached on the linked issue - using a small rust-csv buffer size leads to broken tabular layout.

What is the expected or desired behavior of the code above?

When the internal buffer becomes full, its contents should be written to the underlying writer, but the underlying writer should not be flushed. This seems to match with other buffering IO libraries, such as BufferedWriter in Java and rust's stdlib

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions