`quick_xml::de::from_reader` requires a `BufRead` instead of just an `std::io::Read`

Open
#716 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Start by reading the quick_xml::de::from_reader implementation and the related discussion in issue #499 to determine why it requires BufRead. The issue asks whether support for std::io::Read is feasible and describes a stateless protocol use case; done would mean maintainers agree on the API direction and the reader requirement is addressed.

Written by the indexing model from the issue text.

Description

help wanted

I'm curious why this is the case. Does the implementation require buffering? If not, why not users worry about whether the read uses buffering? Similar thoughts as #499 here. Unless there's particular hesitance, would the maintainers be open to a PR allowing implementations which use unbuffered read?

EDIT: For the purposes of forthrightness I'll go ahead and explain the usecase that caused me to think about this: I have a trait Protocol whose implementers I would like to be stateless (i.e., the structs underlying implementers are just empty types to get to the functions). So I can't give implementers a buffer to manage, and I don't want to allocate extra memory every time I serialize a protocol message. Conversely, I don't want my API to assume consumers are using buffered reading, which may not be their preference for any number of reasons, and so I don't want the buffer to come as an argument to any Protocol functions.

Dominant language
Rust
Stars
1.6k
Forks
299
Avg merge
2d 4h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tafia/quick-xml

All issues in tafia/quick-xml

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.