#container #no-alloc #wrapper

no-std debug-value

Wrapper type for values that are only needed with debug assertions

1 unstable release

0.1.0 Feb 6, 2025

#1442 in Debugging

MIT/Apache

5KB
85 lines

DebugValue

A Wrapper type for values that are only needed with debug assertions.


lib.rs:

A DebugValue<T> is a T that is only present if debug assertions are enabled. On debug builds it has the exact same layout as T. On release builds it is a zero-sized-type.

let mut x = String::from("Mutated but restored by f");
let passed_in = DebugValue::new_cloned(&x);
f(&mut x);
passed_in.assert_eq(&x);

No runtime deps