pub struct ConstSafeInt<const N: usize>(/* private fields */);Expand description
Fixed-size, byte-backed integer that can be converted into SafeInt.
§Examples
use safe_bigmath::integer::ConstSafeInt;
use safe_bigmath::SafeInt;
const ONE: ConstSafeInt<2> = ConstSafeInt::from_bytes([0, 1]);
assert_eq!(SafeInt::from(ONE), SafeInt::from(1));Implementations§
Source§impl<const N: usize> ConstSafeInt<N>
impl<const N: usize> ConstSafeInt<N>
Source§impl ConstSafeInt<17>
impl ConstSafeInt<17>
Sourcepub const fn from_i128(value: i128) -> Self
pub const fn from_i128(value: i128) -> Self
Builds a 17-byte representation from an i128 while preserving the sign bit.
§Examples
use safe_bigmath::integer::ConstSafeInt;
use safe_bigmath::SafeInt;
const NEG_ONE: ConstSafeInt<17> = ConstSafeInt::from_i128(-1);
assert_eq!(SafeInt::from(NEG_ONE), SafeInt::from(-1));Trait Implementations§
Source§impl<const N: usize> Clone for ConstSafeInt<N>
impl<const N: usize> Clone for ConstSafeInt<N>
Source§fn clone(&self) -> ConstSafeInt<N>
fn clone(&self) -> ConstSafeInt<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for ConstSafeInt<N>
impl<const N: usize> Debug for ConstSafeInt<N>
Source§impl<const N: usize> From<&ConstSafeInt<N>> for SafeInt
impl<const N: usize> From<&ConstSafeInt<N>> for SafeInt
Source§fn from(value: &ConstSafeInt<N>) -> SafeInt
fn from(value: &ConstSafeInt<N>) -> SafeInt
Converts to this type from the input type.
Source§impl<const N: usize> From<ConstSafeInt<N>> for SafeInt
impl<const N: usize> From<ConstSafeInt<N>> for SafeInt
Source§fn from(value: ConstSafeInt<N>) -> SafeInt
fn from(value: ConstSafeInt<N>) -> SafeInt
Converts to this type from the input type.
Source§impl<const N: usize> Hash for ConstSafeInt<N>
impl<const N: usize> Hash for ConstSafeInt<N>
Source§impl<const N: usize> PartialEq for ConstSafeInt<N>
impl<const N: usize> PartialEq for ConstSafeInt<N>
impl<const N: usize> Copy for ConstSafeInt<N>
impl<const N: usize> Eq for ConstSafeInt<N>
impl<const N: usize> StructuralPartialEq for ConstSafeInt<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for ConstSafeInt<N>
impl<const N: usize> RefUnwindSafe for ConstSafeInt<N>
impl<const N: usize> Send for ConstSafeInt<N>
impl<const N: usize> Sync for ConstSafeInt<N>
impl<const N: usize> Unpin for ConstSafeInt<N>
impl<const N: usize> UnwindSafe for ConstSafeInt<N>
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