shallow-debug 0.1.0

A basic Debug derive macro that can be used on any type
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 8.19 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 282.81 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • GabrielDertoni/shallow-debug
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • GabrielDertoni

Shallow debug

A crate that allows any type to derive a very simple and "shallow" debug impl. The impl will only print the enum variant, but not the content of the variant. For structs, it will only print the struct's name, and none of it's field's values.

This is mainly useful for enums when the variant is already useful information. Since none of the inner values are printed, they don't have to implement Debug, so this can also be useful in highly generic code where you just want a quick and simple way to get debug information.

Example

#[derive(ShallowDebug)]
enum MyEnum<A, B, C> {
    A(A),
    B(B),
    C(C),
}

let value: MyEnum<i32, &str, usize> = MyEnum::A(123);
assert_eq!(format!("{value:?}"), "MyEnum::A(..)");