[−][src]Struct rustc_middle::ty::consts::int::ScalarInt

#[repr(packed)]pub struct ScalarInt {
    data: u128,
    size: u8,
}

The raw bytes of a simple value.

This is a packed struct in order to allow this type to be optimally embedded in enums (like Scalar).

Fields

data: u128

The first size bytes of data are the value. Do not try to read less or more bytes than that. The remaining bytes must be 0.

size: u8

Implementations

impl ScalarInt[src]

pub const TRUE: ScalarInt[src]

pub const FALSE: ScalarInt[src]

pub const ZST: ScalarInt[src]

pub fn size(self) -> Size[src]

pub(in ty::consts::int) fn check_data(
    self
)
[src]

Make sure the data fits in size. This is guaranteed by all constructors here, but having had this check saved us from bugs many times in the past, so keeping it around is definitely worth it.

pub fn null(size: Size) -> Self[src]

pub fn is_null(self) -> bool[src]

pub(crate) fn ptr_sized_op<E>(
    self,
    dl: &TargetDataLayout,
    f_int: impl FnOnce(u64) -> Result<u64, E>
) -> Result<Self, E>
[src]

pub fn try_from_uint(i: impl Into<u128>, size: Size) -> Option<Self>[src]

pub fn try_from_int(i: impl Into<i128>, size: Size) -> Option<Self>[src]

pub fn assert_bits(self, target_size: Size) -> u128[src]

pub fn to_bits(self, target_size: Size) -> Result<u128, Size>[src]

Trait Implementations

impl Clone for ScalarInt[src]

impl Copy for ScalarInt[src]

impl Debug for ScalarInt[src]

impl<D: Decoder> Decodable<D> for ScalarInt[src]

impl<S: Encoder> Encodable<S> for ScalarInt[src]

impl Eq for ScalarInt[src]

impl From<IeeeFloat<DoubleS>> for ScalarInt[src]

impl From<IeeeFloat<SingleS>> for ScalarInt[src]

impl From<bool> for ScalarInt[src]

impl From<char> for ScalarInt[src]

impl From<u128> for ScalarInt[src]

impl From<u16> for ScalarInt[src]

impl From<u32> for ScalarInt[src]

impl From<u64> for ScalarInt[src]

impl From<u8> for ScalarInt[src]

impl Hash for ScalarInt[src]

impl<CTX> HashStable<CTX> for ScalarInt[src]

impl LowerHex for ScalarInt[src]

impl Ord for ScalarInt[src]

impl PartialEq<ScalarInt> for ScalarInt[src]

impl PartialOrd<ScalarInt> for ScalarInt[src]

impl StructuralEq for ScalarInt[src]

impl StructuralPartialEq for ScalarInt[src]

impl TryFrom<ScalarInt> for u8[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for u16[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for u32[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for u64[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for u128[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for char[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for Single[src]

type Error = Size

The type returned in the event of a conversion error.

impl TryFrom<ScalarInt> for Double[src]

type Error = Size

The type returned in the event of a conversion error.

impl UpperHex for ScalarInt[src]

Auto Trait Implementations

impl RefUnwindSafe for ScalarInt

impl Send for ScalarInt

impl Sync for ScalarInt

impl Unpin for ScalarInt

impl UnwindSafe for ScalarInt

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<Ctxt, T> DepNodeParams<Ctxt> for T where
    Ctxt: DepContext,
    T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]