dbgfmt 0.1.0

Pretty-print Rust Debug trait output with proper indentation
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 44.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 46s Average build duration of successful builds.
  • all releases: 52s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • poi2/dbgfmt
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • poi2

dbgfmt

CI crates.io License: MIT OR Apache-2.0

A zero-dependency Rust library and CLI tool that pretty-prints Rust Debug trait output with proper indentation and newlines.

Example

Input:

Foo { bar: 1, baz: Vec { items: [1, 2, 3] }, name: "hello" }

Output:

Foo {
  bar: 1,
  baz: Vec {
    items: [
      1,
      2,
      3,
    ],
  },
  name: "hello",
}

As a Library

Add to your Cargo.toml:

[dependencies]
dbgfmt = "0.1"

Use in your code:

use dbgfmt::format_debug;

let input = format!("{:?}", my_struct);
let pretty = format_debug(&input, 2);
println!("{pretty}");

As a CLI

Installation

cargo install dbgfmt

Usage

# Pass as argument
dbgfmt 'Foo { bar: 1, baz: [2, 3] }'

# Pipe from stdin
echo 'Foo { bar: 1, baz: [2, 3] }' | dbgfmt

License

Licensed under either of

at your option.