Bogie is an alternative to the default Debug derive which lacks a lot of features.
To start using bogie, just derive Debogue on your structure, enumeration or unions. This will create the classical Debug implementation.
#[derive(Debogue)]
struct MyStruct {
a: usize,
b: usize,
c: usize
}But the strength of bogie is not there. It's in its attributes.
#[derive(Debogue)]
#[bogie(pub_only, hex)]
struct MyStruct {
a: usize,
#[bogie(skip)]
pub b: usize,
#[bogie(dbg)]
pub c: usize,
pub d: usize
}In this example, when formatting this struct using its debug:
awill not be printed, because of thepub_onlyattribute.bwill not be printed, because of theskipattribute.cwill be printed using itsDebugimplementation because of thedbgattribute.dwill be printed using itsLowerHeximplementation because of the globalhexattribute on the struct.
dbg: Use theDebugformatter.display: Use theDisplayformatter.Hex: Use theUpperHexformatter.hex: Use theLowerHexformatter.oct: Use theOctalformatter.ptr: Use thePointerformatter.Exp: Use theUpperExpformatter.exp: Use theLowerExpformatter.bin: Use theBinaryformatter.empty: Prints()instead of the content of this field. Useful for redacting tokens/secrets or for fields not implementing any formatters.fn(path): Use the provided path as formatter. The target function must implementFn(&T, &mut Formatter<'_>) -> core::fmt::Resultwhen targeting a field of typeT.
skip: Will skip this field in debug.
pub_only: Will only print fields with public visibility.enum_prefix(Enum only): Will add the enum name as a prefix as type. i.e.Type::Variant(field)instead ofVariant(field).
Although not tested, this crate should be able to support no_std environments.
Bogie is the wheel assembly of trains, phonetically close to bogue which is bug in French.
MIT License Copyright (c) 2025 OwOchlé