UnsignedPrimitive

Trait UnsignedPrimitive 

Source
pub trait UnsignedPrimitive:
    Sealed
    + Unsigned
    + PrimInt
    + Integer
    + Num<FromStrRadixErr = ParseIntError>
    + Bounded
    + FromStr<Err = ParseIntError>
    + FromPrimitive
    + Into<BigUint>
    + Into<BigInt>
    + Default
    + Display
    + Debug
    + LowerHex
    + UpperHex
    + Sum
    + Product
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + RemAssign
    + BitAndAssign
    + BitOrAssign
    + BitXorAssign
    + Send
    + Sync
    + 'static {
    type Signed: SignedPrimitive;
    type Range: DoubleEndedIterator<Item = Self>;

    // Required methods
    fn random<R: Rng>(rng: &mut R) -> Self;
    fn try_from_biguint(biguint: BigUint) -> Option<Self>;
    fn try_from_bigint(bigint: BigInt) -> Option<Self>;
    fn try_from_signed(signed: Self::Signed) -> Option<Self>;
    fn try_into_signed(self) -> Option<Self::Signed>;
    fn rem_biguint(self, biguint: BigUint) -> BigUint;
    fn rem_bigint(self, bigint: BigInt) -> BigInt;
    fn range(self, end: Self) -> Self::Range;
    fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>;

    // Provided methods
    unsafe fn thread_local_modulus() -> Self { ... }
    unsafe fn set_thread_local_modulus(modulus: Self) { ... }
}
Expand description

A trait for u8, u16, u32, u64, u128, and usize.

Required Associated Types§

Required Methods§

Source

fn random<R: Rng>(rng: &mut R) -> Self

Source

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source

fn try_from_signed(signed: Self::Signed) -> Option<Self>

Source

fn try_into_signed(self) -> Option<Self::Signed>

Source

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source

fn range(self, end: Self) -> Self::Range

Source

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Provided Methods§

Source

unsafe fn thread_local_modulus() -> Self

§Safety

This function is safe as long as Self::thread_local_modulus_key().with does not leak the raw pointer.

Source

unsafe fn set_thread_local_modulus(modulus: Self)

§Safety

This function is safe as long as Self::thread_local_modulus_key().with does not leak the raw pointer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UnsignedPrimitive for u8

Source§

type Signed = i8

Source§

type Range = Range<u8>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: i8) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<i8>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Source§

impl UnsignedPrimitive for u16

Source§

type Signed = i16

Source§

type Range = Range<u16>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: i16) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<i16>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Source§

impl UnsignedPrimitive for u32

Source§

type Signed = i32

Source§

type Range = Range<u32>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: i32) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<i32>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Source§

impl UnsignedPrimitive for u64

Source§

type Signed = i64

Source§

type Range = Range<u64>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: i64) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<i64>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Source§

impl UnsignedPrimitive for u128

Source§

type Signed = i128

Source§

type Range = Range<u128>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: i128) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<i128>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Source§

impl UnsignedPrimitive for usize

Source§

type Signed = isize

Source§

type Range = Range<usize>

Source§

fn random<R: Rng>(rng: &mut R) -> Self

Source§

fn try_from_biguint(biguint: BigUint) -> Option<Self>

Source§

fn try_from_bigint(bigint: BigInt) -> Option<Self>

Source§

fn try_from_signed(signed: isize) -> Option<Self>

Source§

fn try_into_signed(self) -> Option<isize>

Source§

fn rem_biguint(self, biguint: BigUint) -> BigUint

Source§

fn rem_bigint(self, bigint: BigInt) -> BigInt

Source§

fn range(self, end: Self) -> Range<Self>

Source§

fn thread_local_modulus_key() -> &'static LocalKey<UnsafeCell<Self>>

Implementors§