formatter-builder 0.1.1

The safe and stable builder for fmt::Formatter
Documentation
  • Coverage
  • 83.33%
    15 out of 18 items documented9 out of 14 items with examples
  • Size
  • Source code size: 15.26 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • A4-Tacks/formatter-builder-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • A4-Tacks

The safe and stable builder for [fmt::Formatter]

Due to unstable [Formatter::new], uses this crate to dynamically build a [Formatter].

Examples

use formatter_builder::{FormatterBuilder, Fill, Sign, Alignment};

let mut output = String::new();
let n = 6.23;
formatter_builder::FormatterBuilder::new()
    .width(8)
    .align(Alignment::Right)
    .precision(3)
    .fill(Fill::Zero)
    .with(&mut output, |f| {
        std::fmt::Display::fmt(&n, f)
    })
    .unwrap();
assert_eq!(output, "0006.230")