Skip to main content

fastnum/bint/
uint.rs

1mod bits;
2mod carrying;
3mod checked;
4mod cmp;
5mod convert;
6mod endian;
7mod impls;
8mod intrinsics;
9mod math;
10mod num;
11mod overflowing;
12mod powers;
13mod saturating;
14mod strict;
15mod unchecked;
16mod widening;
17mod wrapping;
18
19use bnum::BUint;
20
21use crate::bint::{consts::consts_impl, doc};
22
23/// Generic Unsigned integer type composed of 64-bit
24/// digits, of arbitrary fixed size which must be known at compile time.
25///
26/// Digits are stored in little endian (the least significant digit first).
27/// This integer type aims to exactly replicate the behaviours of Rust's
28/// built-in unsigned integer types: `u8`, `u16`, `u32`, `u64`, `u128` and
29/// `usize`.
30/// The const generic parameter `N` is the number of 64-bit digits that are
31/// stored.
32#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
33#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
34#[cfg_attr(
35    feature = "borsh",
36    derive(borsh::BorshSerialize, borsh::BorshDeserialize, borsh::BorshSchema)
37)]
38#[repr(transparent)]
39pub struct UInt<const N: usize>(pub(super) BUint<N>);
40
41consts_impl!(UInt, U, BUint);