## DebugStrictAdd

# Trait DebugStrictAdd

Source

    pub trait DebugStrictAdd {
        // Required method
        fn debug_strict_add(self, other: Self) -> Self;
    }

Expand description

Addition, but only overflow checked when `cfg(debug_assertions)` is set instead of respecting `-Coverflow-checks`.

This exists for performance reasons, as we ship rustc with overflow checks. While overflow checks are perf neutral in almost all of the compiler, there are a few particularly hot areas where we don’t want overflow checks in our dist builds. Overflow is still a bug there, so we want overflow check for builds with debug assertions.

That’s a long way to say that this should be used in areas where overflow is a bug but overflow checking is too slow.

## Required Methods§

Source

#### fn debug_strict_add(self, other: Self) -> Self

See `DebugStrictAdd`.

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

## Implementations on Foreign Types§

Source§

### impl DebugStrictAdd for i8

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for i16

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for i32

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for i64

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for i128

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for isize

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for u8

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for u16

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for u32

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for u64

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for u128

Source§

#### fn debug_strict_add(self, other: Self) -> Self

Source§

### impl DebugStrictAdd for usize

Source§

#### fn debug_strict_add(self, other: Self) -> Self

## Implementors§