Skip to main content

FromInt

Trait FromInt 

Source
pub trait FromInt<I, A: Sealed> {
    const NARROWING: bool;

    // Required method
    fn from_int(arch: A, value: I) -> Self;
}
Expand description

Perform a potentially lossy conversion from a raw integer.

The associated constant NARROWING can be queried to check if the conversion is allowed to narrow from the provided integer.

Narrowing conversions will only retain the lower bits.

Required Associated Constants§

Source

const NARROWING: bool

Will the conversion only sample from the lower-order bits of the provided integer.

Required Methods§

Source

fn from_int(arch: A, value: I) -> Self

Turn an integer into an instance of Self.

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.

Implementors§

Source§

impl<A: Sealed> FromInt<u8, A> for BitMask<1, A>

Source§

const NARROWING: bool = true

Source§

impl<A: Sealed> FromInt<u8, A> for BitMask<2, A>

Source§

const NARROWING: bool = true

Source§

impl<A: Sealed> FromInt<u8, A> for BitMask<4, A>

Source§

const NARROWING: bool = true

Source§

impl<A: Sealed> FromInt<u8, A> for BitMask<8, A>

Source§

const NARROWING: bool = false

Source§

impl<A: Sealed> FromInt<u16, A> for BitMask<16, A>

Source§

const NARROWING: bool = false

Source§

impl<A: Sealed> FromInt<u32, A> for BitMask<32, A>

Source§

const NARROWING: bool = false

Source§

impl<A: Sealed> FromInt<u64, A> for BitMask<64, A>

Source§

const NARROWING: bool = false