Skip to main content

I256

Struct I256 

Source
pub struct I256 { /* private fields */ }
Expand description

A 256-bit signed integer.

Limbs are the two’s complement representation, least-significant-first, so the layout and the wire encoding match U256 exactly. See the module documentation for the semantics.

Implementations§

Source§

impl I256

Source

pub const ZERO: I256

The additive identity.

Source

pub const ONE: I256

The multiplicative identity.

Source

pub const MINUS_ONE: I256

Negative one, whose two’s complement is all ones.

Source

pub const MAX: I256

The largest representable value, 2^255 - 1.

Source

pub const MIN: I256

The smallest representable value, -2^255.

Its magnitude is one larger than MAX’s, which is why negating, absolute value and division by -1 can all overflow.

Source

pub const BITS: u32 = 256

The size of this integer in bits, sign bit included.

Source

pub const fn from_limbs(limbs: [u32; 8]) -> I256

Constructs a value from its two’s complement limbs, least-significant-first.

Source

pub const fn to_limbs(self) -> [u32; 8]

Returns the two’s complement limbs, least-significant-first.

Source

pub const fn from(n: i128) -> I256

Constructs a value from an i128.

Inherent for the reason U256::from is: From is implemented for every signed width, which would leave I256::from(-1000) ambiguous, and an inherent function shadows the trait in path form and pins the literal to i128. It is also usable in const position.

The trait impls are untouched, so .into() and generic T: Into<I256> still convert from any width – including the unsigned ones, which all fit.

Source

pub const fn from_i128(n: i128) -> I256

Constructs a value from an i128, under a name no trait shadows.

Source

pub const fn from_i32(n: i32) -> I256

Constructs a value from an i32, without widening at the call site.

Source

pub const fn from_i64(n: i64) -> I256

Constructs a value from an i64, without widening at the call site.

Source

pub const fn cast_unsigned(self) -> U256

Reinterprets the two’s complement bits as a U256.

No arithmetic: (-1).cast_unsigned() is U256::MAX. Named after i128::cast_unsigned, which does the same thing at a narrower width.

Source

pub const fn is_zero(self) -> bool

Returns true if this is zero.

Source

pub const fn is_negative(self) -> bool

Returns true if this is strictly less than zero.

Source

pub const fn is_positive(self) -> bool

Returns true if this is strictly greater than zero.

Source

pub const fn signum(self) -> I256

-1, 0 or 1, according to the sign.

Source

pub const fn unsigned_abs(self) -> U256

The absolute value, as a U256.

Total, unlike abs: MIN.unsigned_abs() is 2^255, which a U256 holds comfortably. SignedMath.abs.

Source

pub const fn bit(self, i: u32) -> bool

Returns the bit at i, counting from the least significant. Bit 255 is the sign bit.

Bits at or above BITS read as zero rather than panicking, matching U256::bit – note that this is not a sign extension.

Source

pub const fn const_cmp(self, other: I256) -> Ordering

Comparison usable from a const fn.

Flipping the sign bit maps the signed order onto the unsigned one, so this is U256::const_cmp on the flipped values.

Source

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

Returns the big-endian two’s complement byte representation.

#[inline], not the inline(never) the unsigned pair carries: the body is a reinterpretation and a call, so the byte-swap loop this reaches is U256::to_be_bytes, which is already outlined on rv32 for exactly that reason. Outlining the wrapper too would add a second symbol and a call/return per conversion, not remove one.

Source

pub const fn from_be_bytes(bytes: [u8; 32]) -> I256

Constructs a value from its big-endian two’s complement byte representation.

#[inline] for the reason to_be_bytes gives.

Source§

impl I256

Source

pub const fn overflowing_neg(self) -> (I256, bool)

Negation, with a flag reporting whether it overflowed.

Only MIN overflows: its magnitude has no positive counterpart, and it negates to itself.

Source

pub const fn checked_neg(self) -> Option<I256>

Negation, returning None on overflow.

Source

pub const fn wrapping_neg(self) -> I256

Negation, wrapping on overflow (MIN negates to itself).

Source

pub const fn saturating_neg(self) -> I256

Negation, saturating at MAX.

Source

pub const fn overflowing_abs(self) -> (I256, bool)

Absolute value, with a flag reporting whether it overflowed.

Source

pub const fn checked_abs(self) -> Option<I256>

Absolute value, returning None on overflow.

Source

pub const fn wrapping_abs(self) -> I256

Absolute value, wrapping on overflow (MIN maps to itself).

Source

pub const fn saturating_abs(self) -> I256

Absolute value, saturating at MAX.

Source

pub const fn abs(self) -> I256

Absolute value.

See unsigned_abs for the total version: MIN has no representable absolute value here.

§Panics

On MIN, if overflow-checks is on – otherwise it wraps to MIN, like the primitives.

Source

pub const fn overflowing_add(self, rhs: I256) -> (I256, bool)

Wrapping addition, with a flag reporting whether it overflowed.

Source

pub const fn overflowing_sub(self, rhs: I256) -> (I256, bool)

Wrapping subtraction, with a flag reporting whether it overflowed.

Source

pub const fn checked_add(self, rhs: I256) -> Option<I256>

Addition, returning None on overflow.

Source

pub const fn checked_sub(self, rhs: I256) -> Option<I256>

Subtraction, returning None on overflow.

Source

pub const fn wrapping_add(self, rhs: I256) -> I256

Addition, wrapping on overflow.

Source

pub const fn wrapping_sub(self, rhs: I256) -> I256

Subtraction, wrapping on overflow.

Source

pub const fn saturating_add(self, rhs: I256) -> I256

Addition, saturating at MIN or MAX.

Source

pub const fn saturating_sub(self, rhs: I256) -> I256

Subtraction, saturating at MIN or MAX.

Source

pub const fn overflowing_mul(self, rhs: I256) -> (I256, bool)

Wrapping multiplication, with a flag reporting whether it overflowed.

One 256x256 multiply, not two. The overflow test needs the magnitude product, and the wrapped signed bits follow from it without a second pass: a * b = (-1)^(sign a ^ sign b) * |a| * |b|, and that identity survives reduction mod 2^256, so negating the magnitude product gives exactly the bits cast_unsigned().wrapping_mul() would have.

Which callers this helps is worth being precise about. It is every form that consumes the overflow flag – checked_mul, saturating_mul, this function, and each step of pow. The bare * operator is not among them: in a release contract profile OVERFLOW_CHECKS folds to false, the flag goes unread, and LLVM was already dropping the second multiply as dead.

Measured on rv32 by scripts/bigint-bench.sh -o "mul signed_mul": a saturating signed multiply costs 1095.02 gas against 1019.02 for a bare wrapping unsigned one – +76 gas for the sign handling and the bound check, where a second full schoolbook pass would have been on the order of +1,000.

Source

pub const fn checked_mul(self, rhs: I256) -> Option<I256>

Multiplication, returning None on overflow.

Source

pub const fn wrapping_mul(self, rhs: I256) -> I256

Multiplication, wrapping on overflow.

Source

pub const fn saturating_mul(self, rhs: I256) -> I256

Multiplication, saturating at MIN or MAX.

Source

pub const fn checked_div_rem(self, rhs: I256) -> Option<(I256, I256)>

Divides, returning the quotient and remainder, or None if rhs is zero or the division overflows.

The quotient truncates toward zero and the remainder takes the sign of the dividend, matching Rust’s primitives and Solidity’s int256. MIN / -1 is the one overflow: its quotient is 2^255.

Source

pub const fn div_rem(self, rhs: I256) -> (I256, I256)

Divides, returning the quotient and remainder.

§Panics

If rhs is zero, or on MIN / -1. Both panics are unconditional, and deliberately so: division overflow is the one arithmetic overflow the primitives do not key off overflow-checks. i128::MIN / -1 panics under -C overflow-checks=off exactly as it does with checks on, because the alternative on real hardware is a trap rather than a wrapped value. Matching the primitives here means not gating this.

The consequence is worth stating plainly, since it is the opposite of what the rest of this type does: a contract profile silently wraps MIN + 1 and MIN * 2, but aborts on MIN / -1. Reach for wrapping_div or checked_div if an abort is not what the call site wants.

Source

pub const fn overflowing_div(self, rhs: I256) -> (I256, bool)

Division, with a flag reporting whether it overflowed.

The flag is set only by MIN / -1, whose wrapped quotient is MIN.

§Panics

If rhs is zero.

Source

pub const fn overflowing_rem(self, rhs: I256) -> (I256, bool)

Remainder, with a flag reporting whether it overflowed.

The flag is set only by MIN % -1, whose wrapped remainder is zero.

§Panics

If rhs is zero.

Source

pub const fn checked_div(self, rhs: I256) -> Option<I256>

Division, returning None if rhs is zero or the division overflows.

Source

pub const fn checked_rem(self, rhs: I256) -> Option<I256>

Remainder, returning None if rhs is zero or the division overflows.

Source

pub const fn wrapping_div(self, rhs: I256) -> I256

Division, wrapping on overflow (MIN / -1 is MIN).

§Panics

If rhs is zero.

Source

pub const fn wrapping_rem(self, rhs: I256) -> I256

Remainder, wrapping on overflow (MIN % -1 is zero).

§Panics

If rhs is zero.

Source

pub const fn div_euclid(self, rhs: I256) -> I256

Euclidean division: the quotient whose remainder is never negative.

(-7).div_euclid(2) is -4, where (-7) / 2 is -3.

§Panics

As div_rem.

Source

pub const fn rem_euclid(self, rhs: I256) -> I256

The non-negative remainder of Euclidean division.

§Panics

As div_rem.

Source

pub const fn wrapping_shl(self, n: u32) -> I256

Left shift, masking the shift amount to 0..256.

Bit-identical to the unsigned shift: bits that fall off the top, including the sign bit, are simply gone.

Source

pub const fn wrapping_shr(self, n: u32) -> I256

Arithmetic right shift, masking the shift amount to 0..256.

The sign bit is replicated into the vacated positions, so this rounds toward negative infinity: (-1) >> 1 is -1, not MAX.

Source

pub const fn overflowing_shl(self, n: u32) -> (I256, bool)

Left shift, masking the shift amount and reporting whether the mask changed it.

Source

pub const fn overflowing_shr(self, n: u32) -> (I256, bool)

Arithmetic right shift, masking the shift amount and reporting whether the mask changed it.

Source

pub const fn checked_shl(self, n: u32) -> Option<I256>

Left shift, returning None if the shift amount is at least 256.

Source

pub const fn checked_shr(self, n: u32) -> Option<I256>

Arithmetic right shift, returning None if the shift amount is at least 256.

Source

pub const fn const_bitand(self, rhs: I256) -> I256

Bitwise AND, usable from a const fn.

Source

pub const fn const_bitor(self, rhs: I256) -> I256

Bitwise OR, usable from a const fn.

Source

pub const fn const_bitxor(self, rhs: I256) -> I256

Bitwise XOR, usable from a const fn.

Source

pub const fn const_not(self) -> I256

Bitwise NOT, usable from a const fn. !x is -x - 1.

Source

pub const fn overflowing_pow(self, exp: u32) -> (I256, bool)

Exponentiation, with a flag reporting whether it overflowed.

x.pow(0) is one for every x, matching the primitives.

Source

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

Exponentiation, returning None on overflow.

Source

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

Exponentiation, wrapping on overflow.

Source

pub const fn saturating_pow(self, exp: u32) -> I256

Exponentiation, saturating at MIN or MAX.

Source

pub const fn pow(self, exp: u32) -> I256

Exponentiation.

§Panics

On overflow, if overflow-checks is on – otherwise it wraps.

Source§

impl I256

Source

pub const fn min(self, other: I256) -> I256

The smaller of two values. SignedMath.min.

Shadows Ord::min in method position, which resolves to the same answer; this one is a const fn.

Source

pub const fn max(self, other: I256) -> I256

The larger of two values. SignedMath.max.

Shadows Ord::max in method position, which resolves to the same answer; this one is a const fn.

Source

pub const fn clamp(self, min: I256, max: I256) -> I256

Clamps to the inclusive range min..=max.

§Panics

If min > max, matching Ord::clamp.

Source

pub const fn average(self, other: I256) -> I256

The average of two values, rounded toward zero, without an intermediate that overflows. SignedMath.average.

(a & b) + ((a ^ b) >> 1) is the floor average – the shift is arithmetic, so it rounds toward negative infinity – and the correction below pulls a negative, inexact result back up by one. Note that this differs from U256::average only in that correction, because for a value that cannot be negative the two directions coincide.

Source

pub const fn checked_mul_div(x: I256, y: I256, d: I256) -> Option<I256>

x * y / d computed on the exact 512-bit product, truncating toward zero. Returns None if d is zero or the quotient is out of range.

The signed counterpart of U256::mul_div; see the module docs for why it is a composition rather than a port.

Source

pub const fn mul_div(x: I256, y: I256, d: I256) -> I256

x * y / d computed on the exact 512-bit product, truncating toward zero.

§Panics

If d is zero, or if the quotient is out of range. Both panics are unconditional, as on the unsigned side.

Source

pub const fn checked_mul_div_rounding( x: I256, y: I256, d: I256, rounding: Rounding, ) -> Option<I256>

x * y / d computed on the exact 512-bit product, following rounding. Returns None if d is zero or the result is out of range.

Source

pub const fn mul_div_rounding( x: I256, y: I256, d: I256, rounding: Rounding, ) -> I256

x * y / d computed on the exact 512-bit product, following rounding.

§Panics

As mul_div.

Trait Implementations§

Source§

impl Add for I256

Source§

type Output = I256

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I256) -> I256

Performs the + operation. Read more
Source§

impl AddAssign for I256

Source§

fn add_assign(&mut self, rhs: I256)

Performs the += operation. Read more
Source§

impl BitAnd for I256

Source§

type Output = I256

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: I256) -> I256

Performs the & operation. Read more
Source§

impl BitAndAssign for I256

Source§

fn bitand_assign(&mut self, rhs: I256)

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: I256) -> I256

Performs the | operation. Read more
Source§

impl BitOrAssign for I256

Source§

fn bitor_assign(&mut self, rhs: I256)

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: I256) -> I256

Performs the ^ operation. Read more
Source§

impl BitXorAssign for I256

Source§

fn bitxor_assign(&mut self, rhs: I256)

Performs the ^= operation. Read more
Source§

impl Clone for I256

Source§

fn clone(&self) -> I256

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl CollectAuthHandles for I256

Source§

impl ContractTypeRefSpec for I256

Source§

const INFO: ContractTypeInfo<'static>

The type reference. Transitive type definitions are not carried here; they are retained via the linker-anchor mechanism (__THRUPUT_SPEC_ANCHOR_ROOT) and resolved by spec-tool.
Source§

const SIGNED_PREIMAGE: Option<&'static ContractTypeView<'static>> = _

How this type appears as a signed-token preimage (ContractTypeView::SignedToken’s payload): the type itself by default, or None for a type-erased payload (the SDK’s Opaque overrides this).
Source§

impl Copy for I256

Source§

impl Debug for I256

Source§

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

Renders as sign-magnitude 0x-prefixed hex.

Like U256’s Debug, this does not honour width or fill flags; use {:x} when the exact textual shape matters.

Source§

impl Default for I256

Source§

fn default() -> I256

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

impl Display for I256

Available on crate feature fmt only.
Source§

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

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

impl Div for I256

Source§

fn div(self, rhs: I256) -> I256

Truncating division. Panics on a zero divisor regardless of overflow-checks, matching the primitive integers.

Source§

type Output = I256

The resulting type after applying the / operator.
Source§

impl DivAssign for I256

Source§

fn div_assign(&mut self, rhs: I256)

Performs the /= operation. Read more
Source§

impl Eq for I256

Source§

impl From<bool> for I256

Source§

fn from(b: bool) -> I256

Converts to this type from the input type.
Source§

impl From<i8> for I256

Source§

fn from(n: i8) -> I256

Converts to this type from the input type.
Source§

impl From<i16> for I256

Source§

fn from(n: i16) -> I256

Converts to this type from the input type.
Source§

impl From<i32> for I256

Source§

fn from(n: i32) -> I256

Converts to this type from the input type.
Source§

impl From<i64> for I256

Source§

fn from(n: i64) -> I256

Converts to this type from the input type.
Source§

impl From<i128> for I256

Source§

fn from(n: i128) -> I256

Converts to this type from the input type.
Source§

impl From<u8> for I256

Source§

fn from(n: u8) -> I256

Converts to this type from the input type.
Source§

impl From<u16> for I256

Source§

fn from(n: u16) -> I256

Converts to this type from the input type.
Source§

impl From<u32> for I256

Source§

fn from(n: u32) -> I256

Converts to this type from the input type.
Source§

impl From<u64> for I256

Source§

fn from(n: u64) -> I256

Converts to this type from the input type.
Source§

impl From<u128> for I256

Source§

fn from(n: u128) -> I256

Converts to this type from the input type.
Source§

impl FromStr for I256

Available on crate feature fmt only.
Source§

type Err = ParseI256Error

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

fn from_str(s: &str) -> Result<I256, <I256 as FromStr>::Err>

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

impl Hash for I256

Source§

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

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 IntoTopic for I256

Source§

fn into_topic(&self) -> TopicSrc<'_>

Source§

impl LowerHex for I256

Available on crate feature fmt only.
Source§

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

The two’s complement bits, as the primitives do it: -1 is all fs, not -1.

Source§

impl Mintable for I256

Source§

fn mint_into_parent(preimage: I256, _children: &mut ChildNodeBuf) -> Self

Source§

impl MintableType for I256

Source§

impl Mul for I256

Source§

type Output = I256

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I256) -> I256

Performs the * operation. Read more
Source§

impl MulAssign for I256

Source§

fn mul_assign(&mut self, rhs: I256)

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) -> I256

Performs the unary - operation. Read more
Source§

impl Not for I256

Source§

type Output = I256

The resulting type after applying the ! operator.
Source§

fn not(self) -> I256

Performs the unary ! operation using logical or bitwise negation. Read more
Source§

impl Ord for I256

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for I256

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for I256

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<'r> ReadXDR<'r> for I256

Source§

fn read_xdr<R>(r: &mut R) -> Result<I256, ReadError>
where R: Reader<'r>,

Reads an XDR value from the reader. Read more
Source§

fn read_xdr_in_place<'s, R>( r: &mut R, slot: Slot<'s, Self>, ) -> Result<Init<'s, Self>, ReadError>
where R: Reader<'r>,

Reads an XDR value directly into slot, without first building it on the stack. Read more
Source§

impl ReceiveAuthHandles for I256

Source§

fn receive_auth_handles( &mut self, _handles: &mut impl Iterator<Item = u32>, ) -> Result<(), AuthTokenError>

Source§

impl Rem for I256

Source§

fn rem(self, rhs: I256) -> I256

Remainder, taking the sign of the dividend. Panics on a zero divisor regardless of overflow-checks, matching the primitive integers.

Source§

type Output = I256

The resulting type after applying the % operator.
Source§

impl RemAssign for I256

Source§

fn rem_assign(&mut self, rhs: I256)

Performs the %= operation. Read more
Source§

impl Shl<i8> for I256

Source§

type Output = I256

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

fn shl(self, rhs: i8) -> I256

Performs the << operation. Read more
Source§

impl Shl<i16> for I256

Source§

type Output = I256

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

fn shl(self, rhs: i16) -> I256

Performs the << operation. Read more
Source§

impl Shl<i32> for I256

Source§

type Output = I256

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

fn shl(self, rhs: i32) -> I256

Performs the << operation. Read more
Source§

impl Shl<i64> for I256

Source§

type Output = I256

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

fn shl(self, rhs: i64) -> I256

Performs the << operation. Read more
Source§

impl Shl<i128> for I256

Source§

type Output = I256

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

fn shl(self, rhs: i128) -> I256

Performs the << operation. Read more
Source§

impl Shl<isize> for I256

Source§

type Output = I256

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

fn shl(self, rhs: isize) -> I256

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) -> I256

Performs the << operation. Read more
Source§

impl Shl<u16> for I256

Source§

type Output = I256

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

fn shl(self, rhs: u16) -> I256

Performs the << operation. Read more
Source§

impl Shl<u32> for I256

Source§

type Output = I256

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

fn shl(self, rhs: u32) -> I256

Performs the << operation. Read more
Source§

impl Shl<u64> for I256

Source§

type Output = I256

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

fn shl(self, rhs: u64) -> I256

Performs the << operation. Read more
Source§

impl Shl<u128> for I256

Source§

type Output = I256

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

fn shl(self, rhs: u128) -> I256

Performs the << operation. Read more
Source§

impl Shl<usize> for I256

Source§

type Output = I256

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

fn shl(self, rhs: usize) -> I256

Performs the << operation. Read more
Source§

impl ShlAssign<i8> for I256

Source§

fn shl_assign(&mut self, rhs: i8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i16> for I256

Source§

fn shl_assign(&mut self, rhs: i16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i32> for I256

Source§

fn shl_assign(&mut self, rhs: i32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i64> for I256

Source§

fn shl_assign(&mut self, rhs: i64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i128> for I256

Source§

fn shl_assign(&mut self, rhs: i128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<isize> for I256

Source§

fn shl_assign(&mut self, rhs: isize)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u8> for I256

Source§

fn shl_assign(&mut self, rhs: u8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u16> for I256

Source§

fn shl_assign(&mut self, rhs: u16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u32> for I256

Source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u64> for I256

Source§

fn shl_assign(&mut self, rhs: u64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u128> for I256

Source§

fn shl_assign(&mut self, rhs: u128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<usize> for I256

Source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
Source§

impl Shr<i8> for I256

Source§

type Output = I256

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

fn shr(self, rhs: i8) -> I256

Performs the >> operation. Read more
Source§

impl Shr<i16> for I256

Source§

type Output = I256

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

fn shr(self, rhs: i16) -> I256

Performs the >> operation. Read more
Source§

impl Shr<i32> for I256

Source§

type Output = I256

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

fn shr(self, rhs: i32) -> I256

Performs the >> operation. Read more
Source§

impl Shr<i64> for I256

Source§

type Output = I256

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

fn shr(self, rhs: i64) -> I256

Performs the >> operation. Read more
Source§

impl Shr<i128> for I256

Source§

type Output = I256

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

fn shr(self, rhs: i128) -> I256

Performs the >> operation. Read more
Source§

impl Shr<isize> for I256

Source§

type Output = I256

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

fn shr(self, rhs: isize) -> I256

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) -> I256

Performs the >> operation. Read more
Source§

impl Shr<u16> for I256

Source§

type Output = I256

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

fn shr(self, rhs: u16) -> I256

Performs the >> operation. Read more
Source§

impl Shr<u32> for I256

Source§

type Output = I256

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

fn shr(self, rhs: u32) -> I256

Performs the >> operation. Read more
Source§

impl Shr<u64> for I256

Source§

type Output = I256

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

fn shr(self, rhs: u64) -> I256

Performs the >> operation. Read more
Source§

impl Shr<u128> for I256

Source§

type Output = I256

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

fn shr(self, rhs: u128) -> I256

Performs the >> operation. Read more
Source§

impl Shr<usize> for I256

Source§

type Output = I256

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

fn shr(self, rhs: usize) -> I256

Performs the >> operation. Read more
Source§

impl ShrAssign<i8> for I256

Source§

fn shr_assign(&mut self, rhs: i8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i16> for I256

Source§

fn shr_assign(&mut self, rhs: i16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i32> for I256

Source§

fn shr_assign(&mut self, rhs: i32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i64> for I256

Source§

fn shr_assign(&mut self, rhs: i64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i128> for I256

Source§

fn shr_assign(&mut self, rhs: i128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<isize> for I256

Source§

fn shr_assign(&mut self, rhs: isize)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u8> for I256

Source§

fn shr_assign(&mut self, rhs: u8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u16> for I256

Source§

fn shr_assign(&mut self, rhs: u16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u32> for I256

Source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u64> for I256

Source§

fn shr_assign(&mut self, rhs: u64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u128> for I256

Source§

fn shr_assign(&mut self, rhs: u128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<usize> for I256

Source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
Source§

impl StructuralPartialEq for I256

Source§

impl Sub for I256

Source§

type Output = I256

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I256) -> I256

Performs the - operation. Read more
Source§

impl SubAssign for I256

Source§

fn sub_assign(&mut self, rhs: I256)

Performs the -= operation. Read more
Source§

impl TryFrom<I256> for U256

Source§

fn try_from(n: I256) -> Result<U256, <U256 as TryFrom<I256>>::Error>

Fails for negative values. Use I256::cast_unsigned to reinterpret those bits instead.

Source§

type Error = TryFromIntError

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

impl TryFrom<U256> for I256

Source§

fn try_from(n: U256) -> Result<I256, <I256 as TryFrom<U256>>::Error>

Fails for values above 2^255 - 1, which would land on a negative I256. Use U256::cast_signed to reinterpret those bits instead.

Source§

type Error = TryFromIntError

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

impl UpperHex for I256

Available on crate feature fmt only.
Source§

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

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

impl WriteXDR for I256

Source§

fn write_xdr<F, W>(&self, w: &mut W) -> Result<(), WriteError>
where W: Writer<F>,

Writes this value as XDR data to the writer. Read more
Source§

unsafe fn write_xdr_unchecked<F, W>(&self, w: &mut W)
where W: WriterUnchecked<F>,

Writes this value as XDR data to the writer, without runtime checks. Read more

Auto Trait Implementations§

§

impl Freeze for I256

§

impl RefUnwindSafe for I256

§

impl Send for I256

§

impl Sync for I256

§

impl Unpin for I256

§

impl UnsafeUnpin 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, dest: *mut u8)

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

impl<T> Context for T
where T: Any + Display,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Hash for T
where T: WriteXDR,

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> ReadXDROwned for T
where T: for<'r> ReadXDR<'r>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StaticIfNoAlloc for T

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§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.