pub enum IntLiteral {
Unsized(BigInt),
Signed {
val: BigInt,
size: BigUint,
},
Unsigned {
val: BigUint,
size: BigUint,
},
}
Expand description
An integer literal, which may or may not have been suffixed with U
to indicate
it being an unsigned literal.
Variants§
Implementations§
Source§impl IntLiteral
impl IntLiteral
pub fn unsized_(val: i32) -> IntLiteral
Sourcepub fn as_signed(self) -> BigInt
pub fn as_signed(self) -> BigInt
Returns this number as a signed number. Unsigned numbers are losslessly converted to signed
pub fn as_unsigned(self) -> Option<BigUint>
pub fn is_negative(&self) -> bool
Trait Implementations§
Source§impl Clone for IntLiteral
impl Clone for IntLiteral
Source§fn clone(&self) -> IntLiteral
fn clone(&self) -> IntLiteral
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for IntLiteral
impl Debug for IntLiteral
Source§impl Display for IntLiteral
impl Display for IntLiteral
Source§impl PartialEq for IntLiteral
impl PartialEq for IntLiteral
Source§impl WithLocation for IntLiteral
impl WithLocation for IntLiteral
fn at(self, file_id: usize, span: &impl HasCodespan) -> Loc<Self>where
Self: Sized,
fn between( self, file_id: usize, start: &impl HasCodespan, end: &impl HasCodespan, ) -> Loc<Self>
fn between_locs<T, Y>(self, start: &Loc<T>, end: &Loc<Y>) -> Loc<Self>
fn nowhere(self) -> Loc<Self>where
Self: Sized,
impl StructuralPartialEq for IntLiteral
Auto Trait Implementations§
impl Freeze for IntLiteral
impl RefUnwindSafe for IntLiteral
impl Send for IntLiteral
impl Sync for IntLiteral
impl Unpin for IntLiteral
impl UnwindSafe for IntLiteral
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more