Enum rustc_const_math::ConstInt
[−]
[src]
pub enum ConstInt { I8(i8), I16(i16), I32(i32), I64(i64), I128(i128), Isize(ConstIsize), U8(u8), U16(u16), U32(u32), U64(u64), U128(u128), Usize(ConstUsize), }
rustc_private
)Variants
I8(i8)
rustc_private
)I16(i16)
rustc_private
)I32(i32)
rustc_private
)I64(i64)
rustc_private
)I128(i128)
rustc_private
)Isize(ConstIsize)
rustc_private
)U8(u8)
rustc_private
)U16(u16)
rustc_private
)U32(u32)
rustc_private
)U64(u64)
rustc_private
)U128(u128)
rustc_private
)Usize(ConstUsize)
rustc_private
)Methods
impl ConstInt
[src]
fn new_unsigned(val: u128, ty: UintTy, usize_ty: UintTy) -> Option<ConstInt>
rustc_private
)Creates a new unsigned ConstInt with matching type while also checking that overflow does not happen.
fn new_signed(val: i128, ty: IntTy, isize_ty: IntTy) -> Option<ConstInt>
rustc_private
)Creates a new signed ConstInt with matching type while also checking that overflow does not happen.
fn new_unsigned_truncating(val: u128, ty: UintTy, usize_ty: UintTy) -> ConstInt
rustc_private
)Creates a new unsigned ConstInt with matching type.
fn new_signed_truncating(val: i128, ty: IntTy, isize_ty: IntTy) -> ConstInt
rustc_private
)Creates a new signed ConstInt with matching type.
fn description(&self) -> &'static str
rustc_private
)Description of the type, not the value
fn to_u128_unchecked(self) -> u128
rustc_private
)Erases the type and returns a u128.
This is not the same as -5i8 as u128
but as -5i8 as i128 as u128
fn to_u32(&self) -> Option<u32>
rustc_private
)Converts the value to a u32
if it's in the range 0...std::u32::MAX
fn to_u64(&self) -> Option<u64>
rustc_private
)Converts the value to a u64
if it's in the range 0...std::u64::MAX
fn to_u128(&self) -> Option<u128>
rustc_private
)Converts the value to a u128
if it's in the range 0...std::u128::MAX
fn to_f32(self) -> f32
rustc_private
)fn to_f64(self) -> f64
rustc_private
)fn is_negative(&self) -> bool
rustc_private
)fn try_cmp(self, rhs: Self) -> Result<Ordering, ConstMathErr>
rustc_private
)Compares the values if they are of the same type
fn wrap_incr(self) -> Self
rustc_private
)Adds 1 to the value and wraps around if the maximum for the type is reached
fn int_type(self) -> IntType
rustc_private
)Trait Implementations
impl Copy for ConstInt
[src]
impl Clone for ConstInt
[src]
fn clone(&self) -> ConstInt
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for ConstInt
[src]
impl Encodable for ConstInt
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl Decodable for ConstInt
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<ConstInt, __D::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl Hash for ConstInt
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl Eq for ConstInt
[src]
impl PartialEq for ConstInt
[src]
fn eq(&self, __arg_0: &ConstInt) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ConstInt) -> bool
This method tests for !=
.
impl PartialOrd for ConstInt
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for ConstInt
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Display for ConstInt
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Add for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the +
operator
impl Sub for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the -
operator
impl Mul for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the *
operator
impl BitAnd for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the &
operator
fn bitand(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the &
operator
impl BitOr for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the |
operator
fn bitor(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the |
operator
impl BitXor for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the ^
operator
fn bitxor(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the ^
operator
impl Div for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the /
operator
fn div(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the /
operator
impl Rem for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the %
operator
fn rem(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the %
operator
impl Shl<ConstInt> for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the <<
operator
fn shl(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the <<
operator
impl Shr<ConstInt> for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the >>
operator
fn shr(self, rhs: Self) -> Result<Self, ConstMathErr>
The method for the >>
operator
impl Neg for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the -
operator
fn neg(self) -> Result<Self, ConstMathErr>
The method for the unary -
operator
impl Not for ConstInt
[src]
type Output = Result<Self, ConstMathErr>
The resulting type after applying the !
operator
fn not(self) -> Result<Self, ConstMathErr>
The method for the unary !
operator