pub struct Integer<E: Environment, I: IntegerType> { /* private fields */ }
Implementations§
Source§impl<E: Environment, I: IntegerType> Integer<E, I>
impl<E: Environment, I: IntegerType> Integer<E, I>
Sourcepub fn from_field_lossy(field: &Field<E>) -> Self
pub fn from_field_lossy(field: &Field<E>) -> Self
Casts an integer from a base field, with lossy truncation.
This method is commonly-used by hash-to-integer algorithms, where the hash output does not need to preserve the full base field.
Source§impl<E: Environment, I: IntegerType> Integer<E, I>
impl<E: Environment, I: IntegerType> Integer<E, I>
Trait Implementations§
Source§impl<E: Environment, I: IntegerType> AbsChecked for Integer<E, I>
impl<E: Environment, I: IntegerType> AbsChecked for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> AbsWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> AbsWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Add<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Add<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Add for Integer<E, I>
impl<E: Environment, I: IntegerType> Add for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> AddAssign<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> AddAssign<&Integer<E, I>> for Integer<E, I>
Source§fn add_assign(&mut self, other: &Integer<E, I>)
fn add_assign(&mut self, other: &Integer<E, I>)
Adds other
to self
.
Source§impl<E: Environment, I: IntegerType> AddAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> AddAssign for Integer<E, I>
Source§fn add_assign(&mut self, other: Integer<E, I>)
fn add_assign(&mut self, other: Integer<E, I>)
Adds other
to self
.
Source§impl<E: Environment, I: IntegerType> AddWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> AddWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitAnd<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> BitAnd<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitAnd for Integer<E, I>
impl<E: Environment, I: IntegerType> BitAnd for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitAndAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> BitAndAssign for Integer<E, I>
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the bitwise AND
of self
and other
and assigns the result to self
.
Source§impl<E: Environment, I: IntegerType> BitOr<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> BitOr<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitOr for Integer<E, I>
impl<E: Environment, I: IntegerType> BitOr for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitOrAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> BitOrAssign for Integer<E, I>
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the bitwise OR
of self
and other
and assigns the result to self
.
Source§impl<E: Environment, I: IntegerType> BitXor<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> BitXor<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitXor for Integer<E, I>
impl<E: Environment, I: IntegerType> BitXor for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> BitXorAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> BitXorAssign for Integer<E, I>
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Performs the bitwise XOR
of self
and other
and assigns the result to self
.
Source§impl<E: Clone + Environment, I: Clone + IntegerType> Clone for Integer<E, I>
impl<E: Clone + Environment, I: Clone + IntegerType> Clone for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Compare for Integer<E, I>
impl<E: Environment, I: IntegerType> Compare for Integer<E, I>
Source§fn is_less_than(&self, other: &Self) -> Self::Output
fn is_less_than(&self, other: &Self) -> Self::Output
Returns true
if self
is less than other
.
Source§fn is_greater_than(&self, other: &Self) -> Self::Output
fn is_greater_than(&self, other: &Self) -> Self::Output
Returns true
if self
is greater than other
.
Source§fn is_less_than_or_equal(&self, other: &Self) -> Self::Output
fn is_less_than_or_equal(&self, other: &Self) -> Self::Output
Returns true
if self
is less than or equal to other
.
Source§fn is_greater_than_or_equal(&self, other: &Self) -> Self::Output
fn is_greater_than_or_equal(&self, other: &Self) -> Self::Output
Returns true
if self
is greater than or equal to other
.
type Output = Boolean<E>
Source§impl<E: Environment, I: IntegerType> Debug for Integer<E, I>
impl<E: Environment, I: IntegerType> Debug for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Deref for Integer<E, I>
impl<E: Environment, I: IntegerType> Deref for Integer<E, I>
Source§impl<'de, E: Environment, I: IntegerType> Deserialize<'de> for Integer<E, I>
impl<'de, E: Environment, I: IntegerType> Deserialize<'de> for Integer<E, I>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the integer from a string or bytes.
Source§impl<E: Environment, I: IntegerType> Display for Integer<E, I>
impl<E: Environment, I: IntegerType> Display for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Distribution<Integer<E, I>> for Standard
impl<E: Environment, I: IntegerType> Distribution<Integer<E, I>> for Standard
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Integer<E, I>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Integer<E, I>
T
, using rng
as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
T
, using rng
as
the source of randomness. Read moreSource§impl<E: Environment, I: IntegerType> Div<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Div<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Div for Integer<E, I>
impl<E: Environment, I: IntegerType> Div for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> DivAssign<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> DivAssign<&Integer<E, I>> for Integer<E, I>
Source§fn div_assign(&mut self, other: &Integer<E, I>)
fn div_assign(&mut self, other: &Integer<E, I>)
Divides self
by other
.
Source§impl<E: Environment, I: IntegerType> DivAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> DivAssign for Integer<E, I>
Source§fn div_assign(&mut self, other: Integer<E, I>)
fn div_assign(&mut self, other: Integer<E, I>)
Divides self
by other
.
Source§impl<E: Environment, I: IntegerType> DivWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> DivWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Equal for Integer<E, I>
impl<E: Environment, I: IntegerType> Equal for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> FromBits for Integer<E, I>
impl<E: Environment, I: IntegerType> FromBits for Integer<E, I>
Source§fn from_bits_le(bits_le: &[bool]) -> Result<Self>
fn from_bits_le(bits_le: &[bool]) -> Result<Self>
Initializes a new integer from a list of little-endian bits.
Source§fn from_bits_be(bits_be: &[bool]) -> Result<Self>
fn from_bits_be(bits_be: &[bool]) -> Result<Self>
Initializes a new integer from a list of big-endian bits.
Source§impl<E: Environment, I: IntegerType> FromBytes for Integer<E, I>
impl<E: Environment, I: IntegerType> FromBytes for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> FromField for Integer<E, I>
impl<E: Environment, I: IntegerType> FromField for Integer<E, I>
Source§fn from_field(field: &Self::Field) -> Result<Self>
fn from_field(field: &Self::Field) -> Result<Self>
Casts an integer from a base field.
This method guarantees the following:
- If the field element is larger than the integer domain, then the operation will fail.
- If the field element is smaller than the integer domain, then the operation will succeed.
type Field = Field<E>
Source§impl<E: Environment, I: IntegerType> FromFields for Integer<E, I>
impl<E: Environment, I: IntegerType> FromFields for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> FromStr for Integer<E, I>
impl<E: Environment, I: IntegerType> FromStr for Integer<E, I>
Source§impl<E: Hash + Environment, I: Hash + IntegerType> Hash for Integer<E, I>
impl<E: Hash + Environment, I: Hash + IntegerType> Hash for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Modulo for Integer<E, I>
impl<E: Environment, I: IntegerType> Modulo for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Mul<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Mul<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Mul for Integer<E, I>
impl<E: Environment, I: IntegerType> Mul for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> MulAssign<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> MulAssign<&Integer<E, I>> for Integer<E, I>
Source§fn mul_assign(&mut self, other: &Integer<E, I>)
fn mul_assign(&mut self, other: &Integer<E, I>)
Multiplies self
by other
.
Source§impl<E: Environment, I: IntegerType> MulAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> MulAssign for Integer<E, I>
Source§fn mul_assign(&mut self, other: Integer<E, I>)
fn mul_assign(&mut self, other: Integer<E, I>)
Multiplies self
by other
.
Source§impl<E: Environment, I: IntegerType> MulWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> MulWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Neg for Integer<E, I>
impl<E: Environment, I: IntegerType> Neg for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Not for Integer<E, I>
impl<E: Environment, I: IntegerType> Not for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> One for Integer<E, I>
impl<E: Environment, I: IntegerType> One for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Ord for Integer<E, I>
impl<E: Environment, I: IntegerType> Ord for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Parser for Integer<E, I>
impl<E: Environment, I: IntegerType> Parser for Integer<E, I>
Source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into a integer circuit.
Source§impl<E: PartialEq + Environment, I: PartialEq + IntegerType> PartialEq for Integer<E, I>
impl<E: PartialEq + Environment, I: PartialEq + IntegerType> PartialEq for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> PartialOrd for Integer<E, I>
impl<E: Environment, I: IntegerType> PartialOrd for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Pow<&Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Pow<&Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Pow<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Pow<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> PowWrapped<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> PowWrapped<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Rem<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Rem<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Rem for Integer<E, I>
impl<E: Environment, I: IntegerType> Rem for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> RemAssign<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> RemAssign<&Integer<E, I>> for Integer<E, I>
Source§fn rem_assign(&mut self, other: &Integer<E, I>)
fn rem_assign(&mut self, other: &Integer<E, I>)
Returns the remainder
of self
divided by other
.
Source§impl<E: Environment, I: IntegerType> RemAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> RemAssign for Integer<E, I>
Source§fn rem_assign(&mut self, other: Integer<E, I>)
fn rem_assign(&mut self, other: Integer<E, I>)
Returns the remainder
of self
divided by other
.
Source§impl<E: Environment, I: IntegerType> RemWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> RemWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Serialize for Integer<E, I>
impl<E: Environment, I: IntegerType> Serialize for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Shl<&Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Shl<&Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Shl<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Shl<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShlAssign<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShlAssign<Integer<E, M>> for Integer<E, I>
Source§fn shl_assign(&mut self, n: Integer<E, M>)
fn shl_assign(&mut self, n: Integer<E, M>)
Shifts self
to the left by n
bits and assigns the result to self
.
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShlChecked<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShlChecked<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShlWrapped<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShlWrapped<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Shr<&Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Shr<&Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> Shr<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> Shr<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShrAssign<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShrAssign<Integer<E, M>> for Integer<E, I>
Source§fn shr_assign(&mut self, n: Integer<E, M>)
fn shr_assign(&mut self, n: Integer<E, M>)
Shifts self
to the right by n
bits and assigns the result to self
.
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShrChecked<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShrChecked<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType, M: Magnitude> ShrWrapped<Integer<E, M>> for Integer<E, I>
impl<E: Environment, I: IntegerType, M: Magnitude> ShrWrapped<Integer<E, M>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> SizeInBits for Integer<E, I>
impl<E: Environment, I: IntegerType> SizeInBits for Integer<E, I>
Source§fn size_in_bits() -> usize
fn size_in_bits() -> usize
Returns the integer size in bits.
Source§impl<E: Environment, I: IntegerType> SizeInBytes for Integer<E, I>
impl<E: Environment, I: IntegerType> SizeInBytes for Integer<E, I>
Source§fn size_in_bytes() -> usize
fn size_in_bytes() -> usize
Returns the integer size in bytes.
Source§impl<E: Environment, I: IntegerType> Square for Integer<E, I>
impl<E: Environment, I: IntegerType> Square for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Sub<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Sub<&Integer<E, I>> for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Sub for Integer<E, I>
impl<E: Environment, I: IntegerType> Sub for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> SubAssign<&Integer<E, I>> for Integer<E, I>
impl<E: Environment, I: IntegerType> SubAssign<&Integer<E, I>> for Integer<E, I>
Source§fn sub_assign(&mut self, other: &Integer<E, I>)
fn sub_assign(&mut self, other: &Integer<E, I>)
Subtracts other
from self
.
Source§impl<E: Environment, I: IntegerType> SubAssign for Integer<E, I>
impl<E: Environment, I: IntegerType> SubAssign for Integer<E, I>
Source§fn sub_assign(&mut self, other: Integer<E, I>)
fn sub_assign(&mut self, other: Integer<E, I>)
Subtracts other
from self
.
Source§impl<E: Environment, I: IntegerType> SubWrapped for Integer<E, I>
impl<E: Environment, I: IntegerType> SubWrapped for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Ternary for Integer<E, I>
impl<E: Environment, I: IntegerType> Ternary for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> ToBits for Integer<E, I>
impl<E: Environment, I: IntegerType> ToBits for Integer<E, I>
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Outputs the little-endian bit representation of self
without trailing zeros.
Source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Outputs the big-endian bit representation of self
without leading zeros.
Source§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
self
as a boolean array in little-endian order.Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
self
as a boolean array in big-endian order.Source§impl<E: Environment, I: IntegerType> ToBytes for Integer<E, I>
impl<E: Environment, I: IntegerType> ToBytes for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> ToField for Integer<E, I>
impl<E: Environment, I: IntegerType> ToField for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> ToFields for Integer<E, I>
impl<E: Environment, I: IntegerType> ToFields for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> TypeName for Integer<E, I>
impl<E: Environment, I: IntegerType> TypeName for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Visibility for Integer<E, I>
impl<E: Environment, I: IntegerType> Visibility for Integer<E, I>
Source§impl<E: Environment, I: IntegerType> Zero for Integer<E, I>
impl<E: Environment, I: IntegerType> Zero for Integer<E, I>
impl<E: Copy + Environment, I: Copy + IntegerType> Copy for Integer<E, I>
impl<E: Eq + Environment, I: Eq + IntegerType> Eq for Integer<E, I>
impl<E: Environment, I: IntegerType> IntegerCore<I> for Integer<E, I>
impl<E: Environment, I: IntegerType> IntegerTrait<I, Integer<E, u8>, Integer<E, u16>, Integer<E, u32>> for Integer<E, I>
impl<E: Environment, I: IntegerType> StructuralPartialEq for Integer<E, I>
Auto Trait Implementations§
impl<E, I> Freeze for Integer<E, I>where
I: Freeze,
impl<E, I> RefUnwindSafe for Integer<E, I>where
I: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, I> Send for Integer<E, I>
impl<E, I> Sync for Integer<E, I>
impl<E, I> Unpin for Integer<E, I>
impl<E, I> UnwindSafe for Integer<E, I>where
I: UnwindSafe,
E: UnwindSafe,
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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> 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