#[derive(DebugNoInline)]Expand description
Derive macro equivalent to #[derive(Debug)] but with #[inline(never)] on
the generated fmt implementation.
Rust’s built-in Debug derive emits #[inline] on fmt. For large or deeply
nested types — typically error enums formatted on fan-out paths — that lets
rustc inline the whole Debug tree into every {:?} / ?err call site,
which can bloat binary size. This derive preserves the exact Debug output and
only changes the inlining hint.
Use it for large/nested types whose Debug is formatted in hot or fan-out
paths; keep #[derive(Debug)] for small, hot, leaf types. See
docs/development/rust-performance-principles.md, “Derived trait impls are
#[inline]”.
§Example
ⓘ
use vtcode_macros::DebugNoInline;
#[derive(DebugNoInline)]
pub struct Widgets {
foo: u32,
bar: usize,
}
assert_eq!(
format!("{:?}", Widgets { foo: 1, bar: 2 }),
"Widgets { foo: 1, bar: 2 }"
);