#[repr(C)]pub struct DebugOnly {
pub _address: u8,
}
Expand description
DebugOnly contains a value of type T, but only in debug builds. In release builds, it does not contain a value. This helper is intended to be used with MOZ_ASSERT()-style macros, allowing one to write:
DebugOnly
more concisely than declaring |check| conditional on #ifdef DEBUG.
DebugOnly instances can only be coerced to T in debug builds. In release builds they don’t have a value, so type coercion is not well defined.
NOTE: DebugOnly instances still take up one byte of space, plus padding, even in optimized, non-DEBUG builds (see bug 1253094 comment 37 for more info). For this reason the class is MOZ_STACK_CLASS to prevent consumers using DebugOnly for struct/class members and unwittingly inflating the size of their objects in release builds.
Fields§
§_address: u8