Skip to content

DecoderReader probably should accept BufRead instead of Read #230

Open
@Kixunil

Description

I noticed DecoderReader holds its internal buffer of bytes. This has a number of disadvantages:

  • Needless copying from in-memory readers (slices)
  • Double-buffering already-buffered readers
  • The bytes are lost when dropping or calling into_inner
  • BUF_SIZE is not configurable
  • std::io::BufReader has access to some unstable optimizations which this crate cannot use
  • Reinvents the wheel; there already is std::io::BufReader

Unless I'm missing something this can be easily fixed just by requiring BufRead instead of Read and using it. It's a breaking change so it's better to do it before 1.0.

Related: maybe it itself could provide BufRead but I'm not sure if 3-byte buffer is fine or not.

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