dbg-pls
A Debug-like trait for rust that outputs properly formatted code
Usage in libraries
Add to your Cargo.toml
= "*"
Add to your types
Usage for applications
Add to your Cargo.toml
= { = "0.1", = ["pretty"] }
And print using debug, eg
println!;
Features
derive- enables the#[derive(DebugPls)]derive (default)pretty- enables thedebugfunction for pretty printingcolors- enables thecolorfunction for syntax highlighted printing
Example
use ;
let mut val = ;
val.bar = "Hello, world! I am a very long string";
println!;
Outputs
[
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo {
foo: 5,
bar: "Hello, world! I am a very long string",
},
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
Demo { foo: 5, bar: "hello" },
]
Example (highlighting)
use ;
let mut val = ;
val.bar = "Hello, world! I am a very long string";
println!;
Outputs:
