INNER CODE UNIT · Rust
fmt
0xMiden/crypto · miden-crypto-derive/src/lib.rs:34
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
write!(f, "<elided secret for {}>", stringify!(#name))
}
}
};
TokenStream::from(expanded)
}
// SILENT DISPLAY MACRO
// ================================================================================================
/// Derives a Display implementation that elides secret values.
///
/// This macro generates a Display implementation that outputs `<elided secret for TypeName>`
/// instead of the actual field values. While implementing Display for secret keys is
/// generally discouraged (as Display implies "user-facing output"), this safe implementation
/// prevents compilation errors in generic contexts while still protecting sensitive data.