Skip to content

format_into() requires io::Write; what about fmt::Write in Debug/Display impls? #375

@aldanor

Description

@aldanor

Simple (and the most common, I believe) use case - you're implementing Display or Debug for your type containing some time objects, and you are provided with std::fmt::Formatter which implements std::fmt::Write trait. (maybe I'm missing something trivial, so apologies in advance if that's the case)

Current format_into implementations though require &mut impl std::io::Write which is a different beast, more complex and aimed at different stuff, with vectored writes, flushing and all the rest. If one were to choose between the two, wouldn't it make sense to support fmt::Write and not io::Write? Is there a clean alternative way?

(There's crates like fmt2io that provide hacky bridges but that's just ugly and wrong)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-formattingArea: formattingC-blockedCategory: blocked by another (possibly upstream) issueC-breakingCategory: breaking changeC-feature-requestCategory: a new feature (not already implemented)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions