Signature
Examples
Trait functions
wrapping_add
Wrapping (modular) addition. Computesself + other, wrapping around at the boundary of the
type.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
pub trait WrappingAdd
use core::num::traits::WrappingAdd;
let result = 255_u8.wrapping_add(1);
assert!(result == 0);
let result = 100_u8.wrapping_add(200);
assert!(result == 44); // (100 + 200) % 256 = 44
self + other, wrapping around at the boundary of the
type.
fn wrapping_add(self: T, v: T) -> T
Was this page helpful?