Crates.io | better-debug |
lib.rs | better-debug |
version | 1.0.1 |
source | src |
created_at | 2023-11-11 22:53:05.240573 |
updated_at | 2023-11-11 23:00:56.001102 |
description | A cooler, and sane Debug macro |
homepage | |
repository | https://github.com/rakbladsvalsen/BetterDebug |
max_upload_size | |
id | 1032486 |
size | 21,032 |
This crate aims to provide a nice, and actually sane implementation of the Debug
trait.
This macro provides the following features, compared to the standard library Debug
's macro:
None
in your custom formatter if you want to skip printing that specific field, or if you want to use the default formatter. All of this can be configured via a macro attribute.Note: You can find more examples here.
use better_debug::BetterDebug;
fn foo(foo: &Foo) -> Option<&'static str> {
if foo.bar.len() < 5 {
return Some("lorem ipsum");
}
None
}
#[derive(BetterDebug)]
struct Foo {
#[better_debug(cust_formatter = "foo")]
bar: String,
baz: String,
}
MIT