pub enum Integer {
U8,
U16,
U32,
U64,
I8,
I16,
I32,
I64,
}Variants§
Implementations§
Source§impl Integer
impl Integer
pub const fn is_signed(&self) -> bool
pub const fn min_value(&self) -> i128
pub const fn max_value(&self) -> i128
pub const fn size_bits(&self) -> u32
Sourcepub const fn find_smallest(
min: i128,
max: i128,
size_bits: u64,
) -> Option<Integer>
pub const fn find_smallest( min: i128, max: i128, size_bits: u64, ) -> Option<Integer>
Find the smallest integer type that can fully contain the min and max
and is equal or larger than the given size_bits.
This function has a preference for unsigned integers. You can force a signed integer by making the min be negative (e.g. -1)
Sourcepub const fn bits_required(&self, min: i128, max: i128) -> u32
pub const fn bits_required(&self, min: i128, max: i128) -> u32
Given the min and the max and the sign of the integer, how many bits are required to fit the min and max? (inclusive)
Trait Implementations§
impl Copy for Integer
impl Eq for Integer
impl StructuralPartialEq for Integer
Auto Trait Implementations§
impl Freeze for Integer
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnsafeUnpin for Integer
impl UnwindSafe for Integer
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T> SpanExt for T
impl<T> SpanExt for T
fn with_span(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
Source§fn spanned(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
fn spanned(self, span: impl Into<Span>) -> Spanned<Self>where
Self: Sized,
Same as
Self::with_span, but can avoid name collisionsfn with_dummy_span(self) -> Spanned<Self>where
Self: Sized,
fn into_with_dummy_span<T>(self) -> Spanned<T>where
Self: Into<T>,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.