mitsuhiko / mitsuhiko/elementtree-rust

Should it be `fmt::Write` instead of `io::Write`?

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
61
Forks
8
PR merge metrics
No merged PRs in 30d

Description

fmt::Write makes the assumption that the inputs will be unicode, which is usually a good assumption for textual formats, and I notice that assumption is already being assumed in Element::to_string, which panics if the serialization of the tree isn't unicode.

fmt::Write also doesn't do flushing. Are you using flushing?

I ask because outputting only to an io::Write makes it annoying to use Elements into format functions, they can't implement Display. I don't actually know how to make an adaptor between the two writes, so I'm just writing to a string then fmting the string.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reviewing the Element::to_string entry point and the current serialization output API. Determine whether fmt::Write can replace io::Write, whether flushing is required, and how Display integration should work; done means a decided API direction with corresponding behavior and tests identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.