# Trait rustc_serialize::int_overflow::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`.

## Object Safety§

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§