Expand description
Serial Number arithmetic following RFC 1982 semantics.
A serial number is a fixed-width unsigned integer whose operations “wrap around” (wraparound).
Its biggest difference from an ordinary integer is comparison: in the wraparound space MAX
is the predecessor of 0, so Serial(MAX) < Serial(0).
- Add / subtract an offset:
Serial + T/Serial - T, both wraparound operations. - Wraparound comparison: implements
PartialOrd. When two serial numbers are exactly half a cycle apart, their ordering is undefined andpartial_cmpreturnsNone(this is whyPartialOrdis used instead ofOrd).
Generics support u8 / u16 / u32 / u64 / u128 / usize and other widths.
Structs§
- Serial
- A wraparound serial number.
Traits§
- Serial
Primitive - An unsigned integer type that can serve as the underlying storage for a serial number.