dtolnay/ryu

A Display implementation?

droundy opened this issue · 1 comments

I'm missing in this crate a Display implementation so that it could be easy to use when formatting numbers. Ideally this would also allow for reducing precision and other formatting flags.

Closing because I would prefer not to expose customization of the precision and other flags in this library. The algorithm should generalize to this though, so someone could make a fork with this functionality.

For implementing a Display impl based on ryu's formatting, the following would work:

let mut buffer = ryu::Buffer::new();
formatter.write_str(buffer.format(1.234))?;