Struct std::num::Wrapping
[−]
[src]
pub struct Wrapping<T>(pub T);
Provides intentionally-wrapped arithmetic on T
.
Operations like +
on u32
values is intended to never overflow,
and in some debug configurations overflow is detected and results
in a panic. While most arithmetic falls into this category, some
code explicitly expects and relies upon modular arithmetic (e.g.,
hashing).
Wrapping arithmetic can be achieved either through methods like
wrapping_add
, or through the Wrapping<T>
type, which says that
all standard arithmetic operations on the underlying value are
intended to have wrapping semantics.