0.5.2
Add the option to opt out from implementing the Default
trait similar to the fmt::Debug
trait.
#[bitfield(u64, debug = false, default = false)]
struct CustomDebug {
data: u64
}
impl fmt::Debug for CustomDebug {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "0x{:x}", self.data())
}
}
impl Default for CustomDebug {
fn default() -> Self {
Self(123) // note: you can also use `#[bits(64, default = 123)]`
}
}
let val = CustomDebug::default();
println!("{val:?}")