#[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
Trait Implementations§
source§impl PartialEq for DebugOnly
impl PartialEq for DebugOnly
impl StructuralPartialEq for DebugOnly
Auto Trait Implementations§
impl Freeze for DebugOnly
impl RefUnwindSafe for DebugOnly
impl Send for DebugOnly
impl Sync for DebugOnly
impl Unpin for DebugOnly
impl UnwindSafe for DebugOnly
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more