Conversation
cmyr
left a comment
There was a problem hiding this comment.
Interesting. I trust you've found this useful for something and it's not very intrusive, so I'm happy to merge. A few little questions inline, but nothing blocking.
| /// Glue for usage of the write! macro. | ||
| /// | ||
| /// This method should generally not be invoked manually, but rather through the write! macro itself. | ||
| pub fn write_fmt(&mut self, fmt: std::fmt::Arguments<'_>) -> AttributesAdder { |
There was a problem hiding this comment.
Maybe add #[doc(hidden)] on this, since it's really an implementation detail and doesn't need to show up in public docs?
Hmm, should we be implementing the Write trait directly? Is this depending on an implementation detail of the macro, where it calls write_fmt with no qualifiers, instead of doing like Write::write_fmt(writer, args)?
There was a problem hiding this comment.
I didn't implement Write because it returns a Result, I wanted it to feel more like format!.
Is this depending on an implementation detail of the macro?
the docs say it just needs something with write_fmt method.
The writer may be any value with a write_fmt method; generally this comes from an implementation of either the fmt::Write or the io::Write trait.
I found myself doing a lot of |
|
It's possible this also saves us an intermediate allocation, although I'm not sure about this part. |
* write! for RichTextBuilder * panic on formatting error * Fix doc test * Make write_fmt doc hidden Co-authored-by: Colin Rofls <colin@cmyr.net>
No description provided.