Expand description
Provides OneBased* unsigned int types, which wraps several integers as 1-based index.
Example:
let v: OneBasedU32 = "5".parse().unwrap();
assert_eq!(v.as_zero_based(), 4);
assert_eq!(v.as_one_based(), NonZeroU32::new(5).unwrap());
let v: Result<OneBasedU32, OneBasedError> = OneBasedU32::from_one_based(0);
assert_eq!(v.unwrap_err(), OneBasedError::ZeroIndex);Structs§
- OneBased
U8 - Represents 1-based index of u8.
- OneBased
U16 - Represents 1-based index of u16.
- OneBased
U32 - Represents 1-based index of u32.
- OneBased
U64 - Represents 1-based index of u64.
- OneBased
U128 - Represents 1-based index of u128.
- OneBased
Usize - Represents 1-based index of usize.
Enums§
- OneBased
Error - Error type used when converting integer to OneBased* types.