pub struct I256(/* private fields */);Expand description
A 256-bit data type with some conversions implemented that interpret it as a signed integer.
This should only implement conversions. If anything else is needed, we should strongly consider an alternative design.
Implementations§
Source§impl I256
impl I256
Sourcepub fn into_scalar<S: Scalar>(self) -> S
pub fn into_scalar<S: Scalar>(self) -> S
Conversion into a Scalar type. The conversion handles negative values. In other words, -1 maps to -S::ONE.
NOTE: the behavior of this is undefined if the absolute value is larger than the modulus.
NOTE: this is not a particularly efficient method. Please either refactor or avoid when performance matters.
Sourcepub fn from_num_bigint(value: &BigInt) -> Self
pub fn from_num_bigint(value: &BigInt) -> Self
Conversion from a num_bigint::BigInt.
The conversion handles negative values and also wraps when the value is too large for an I256.
NOTE: this is not a particularly efficient method. Please either refactor or avoid when performance matters.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for I256
impl<'de> Deserialize<'de> for I256
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for I256
impl Eq for I256
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> 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
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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