arrow_buffer

Struct i256

Source
#[repr(C)]
pub struct i256 { low: u128, high: i128, }
Expand description

A signed 256-bit integer

Fields§

§low: u128§high: i128

Implementations§

Source§

impl i256

Source

pub const ZERO: Self = _

The additive identity for this integer type, i.e. 0.

Source

pub const ONE: Self = _

The multiplicative identity for this integer type, i.e. 1.

Source

pub const MINUS_ONE: Self = _

The multiplicative inverse for this integer type, i.e. -1.

Source

pub const MAX: Self = _

The maximum value that can be represented by this integer type

Source

pub const MIN: Self = _

The minimum value that can be represented by this integer type

Source

pub const fn from_le_bytes(b: [u8; 32]) -> Self

Create an integer value from its representation as a byte array in little-endian.

Source

pub const fn from_be_bytes(b: [u8; 32]) -> Self

Create an integer value from its representation as a byte array in big-endian.

Source

pub const fn from_i128(v: i128) -> Self

Create an i256 value from a 128-bit value.

Source

pub fn from_string(value_str: &str) -> Option<Self>

Create an integer value from its representation as string.

Source

pub fn from_f64(v: f64) -> Option<Self>

Create an optional i256 from the provided f64. Returning None if overflow occurred

Source

pub const fn from_parts(low: u128, high: i128) -> Self

Create an i256 from the provided low u128 and high i128

Source

pub const fn to_parts(self) -> (u128, i128)

Returns this i256 as a low u128 and high i128

Source

pub fn to_i128(self) -> Option<i128>

Converts this i256 into an i128 returning None if this would result in truncation/overflow

Source

pub fn as_i128(self) -> i128

Wraps this i256 into an i128

Source

pub const fn to_le_bytes(self) -> [u8; 32]

Return the memory representation of this integer as a byte array in little-endian byte order.

Source

pub const fn to_be_bytes(self) -> [u8; 32]

Return the memory representation of this integer as a byte array in big-endian byte order.

Source

fn from_bigint_with_overflow(v: BigInt) -> (Self, bool)

Create an i256 from the provided BigInt returning a bool indicating if overflow occurred

Source

pub fn wrapping_abs(self) -> Self

Computes the absolute value of this i256

Source

pub fn checked_abs(self) -> Option<Self>

Computes the absolute value of this i256 returning None if Self == Self::MIN

Source

pub fn wrapping_neg(self) -> Self

Negates this i256

Source

pub fn checked_neg(self) -> Option<Self>

Negates this i256 returning None if Self == Self::MIN

Source

pub fn wrapping_add(self, other: Self) -> Self

Performs wrapping addition

Source

pub fn checked_add(self, other: Self) -> Option<Self>

Performs checked addition

Source

pub fn wrapping_sub(self, other: Self) -> Self

Performs wrapping subtraction

Source

pub fn checked_sub(self, other: Self) -> Option<Self>

Performs checked subtraction

Source

pub fn wrapping_mul(self, other: Self) -> Self

Performs wrapping multiplication

Source

pub fn checked_mul(self, other: Self) -> Option<Self>

Performs checked multiplication

Source

fn div_rem(self, other: Self) -> Result<(Self, Self), DivRemError>

Division operation, returns (quotient, remainder). This basically implements [Long division]: <https://en.wikipedia.org/wiki/Division_algorithm>

Source

fn as_digits(self) -> [u64; 4]

Interpret this i256 as 4 u64 digits, least significant first

Source

fn from_digits(digits: [u64; 4]) -> Self

Interpret 4 u64 digits, least significant first, as a i256

Source

pub fn wrapping_div(self, other: Self) -> Self

Performs wrapping division

Source

pub fn checked_div(self, other: Self) -> Option<Self>

Performs checked division

Source

pub fn wrapping_rem(self, other: Self) -> Self

Performs wrapping remainder

Source

pub fn checked_rem(self, other: Self) -> Option<Self>

Performs checked remainder

Source

pub fn checked_pow(self, exp: u32) -> Option<Self>

Performs checked exponentiation

Source

pub fn wrapping_pow(self, exp: u32) -> Self

Performs wrapping exponentiation

Source

pub const fn signum(self) -> Self

Returns a number i256 representing sign of this i256.

0 if the number is zero 1 if the number is positive -1 if the number is negative

Source

pub const fn is_negative(self) -> bool

Returns true if this i256 is negative

Source

pub const fn is_positive(self) -> bool

Returns true if this i256 is positive

Trait Implementations§

Source§

impl<'a, 'b> Add<&'b i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b i256) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a i256> for i256

Source§

type Output = i256

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a i256) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i256) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for i256

Source§

type Output = i256

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for i256

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl ArrowNativeType for i256

Source§

fn from_usize(u: usize) -> Option<Self>

Convert native integer type from usize Read more
Source§

fn as_usize(self) -> usize

Convert to usize according to the as operator
Source§

fn usize_as(i: usize) -> Self

Convert from usize according to the as operator
Source§

fn to_usize(self) -> Option<usize>

Convert native type to usize. Read more
Source§

fn to_isize(self) -> Option<isize>

Convert native type to isize. Read more
Source§

fn to_i64(self) -> Option<i64>

Convert native type to i64. Read more
Source§

fn get_byte_width() -> usize

Returns the byte width of this native type.
Source§

fn from_i32(_: i32) -> Option<Self>

👎Deprecated: please use Option::Some instead
Convert native type from i32. Read more
Source§

fn from_i64(_: i64) -> Option<Self>

👎Deprecated: please use Option::Some instead
Convert native type from i64. Read more
Source§

fn from_i128(_: i128) -> Option<Self>

👎Deprecated: please use Option::Some instead
Convert native type from i128. Read more
Source§

impl AsPrimitive<i256> for i16

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for i32

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for i64

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for i8

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for u16

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for u32

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for u64

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl AsPrimitive<i256> for u8

Source§

fn as_(self) -> i256

Convert a value to another, using the as operator.
Source§

impl BitAnd for i256

Source§

type Output = i256

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for i256

Source§

type Output = i256

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitXor for i256

Source§

type Output = i256

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl Clone for i256

Source§

fn clone(&self) -> i256

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for i256

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for i256

Source§

fn default() -> i256

Returns the “default value” for a type. Read more
Source§

impl Display for i256

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b> Div<&'b i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'b i256) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<&'a i256> for i256

Source§

type Output = i256

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a i256) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i256) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for i256

Source§

type Output = i256

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign for i256

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl From<i16> for i256

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for i256

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for i256

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for i256

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for i256

Source§

type Err = ParseI256Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for i256

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, 'b> Mul<&'b i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b i256) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a i256> for i256

Source§

type Output = i256

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a i256) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i256) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for i256

Source§

type Output = i256

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign for i256

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for i256

Source§

type Output = i256

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for i256

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for i256

Source§

fn eq(&self, other: &i256) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for i256

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, 'b> Rem<&'b i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'b i256) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a i256> for i256

Source§

type Output = i256

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a i256) -> Self::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i256) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for i256

Source§

type Output = i256

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl RemAssign for i256

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl Shl<u8> for i256

Source§

type Output = i256

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u8) -> Self::Output

Performs the << operation. Read more
Source§

impl Shr<u8> for i256

Source§

type Output = i256

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u8) -> Self::Output

Performs the >> operation. Read more
Source§

impl<'a, 'b> Sub<&'b i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b i256) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a i256> for i256

Source§

type Output = i256

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a i256) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i256> for &'a i256

Source§

type Output = i256

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i256) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for i256

Source§

type Output = i256

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign for i256

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl ToPrimitive for i256

Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

impl Copy for i256

Source§

impl Eq for i256

Source§

impl Sealed for i256

Source§

impl StructuralPartialEq for i256

Auto Trait Implementations§

§

impl Freeze for i256

§

impl RefUnwindSafe for i256

§

impl Send for i256

§

impl Sync for i256

§

impl Unpin for i256

§

impl UnwindSafe for i256

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToByteSlice for T
where T: ArrowNativeType,

Source§

fn to_byte_slice(&self) -> &[u8]

Converts this instance into a byte slice
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,