pub struct Field<E>where
    E: Environment,{ /* private fields */ }

Implementations§

§

impl<E> Field<E>where E: Environment,

pub const SIZE_IN_BITS: usize = <E::Field>::SIZE_IN_BITS

The field size in bits.

pub const SIZE_IN_BYTES: usize = (<E::Field>::SIZE_IN_BITS + 7) / 8

The field size in bytes.

pub const SIZE_IN_DATA_BITS: usize = <E::Field>::SIZE_IN_DATA_BITS

The field capacity for data bits.

pub const fn new(field: <E as Environment>::Field) -> Field<E>

Initializes a new field.

pub fn new_domain_separator(domain: &str) -> Field<E>

Initializes a new field as a domain separator.

pub fn from_u8(value: u8) -> Field<E>

Initializes a new field from a u8.

pub fn from_u16(value: u16) -> Field<E>

Initializes a new field from a u16.

pub fn from_u32(value: u32) -> Field<E>

Initializes a new field from a u32.

pub fn from_u64(value: u64) -> Field<E>

Initializes a new field from a u64.

pub fn from_u128(value: u128) -> Field<E>

Initializes a new field from a u128.

pub fn half() -> Field<E>

Returns 1 * 2^{-1}.

Trait Implementations§

§

impl<E> Add<&Field<E>> for Field<E>where E: Environment,

§

fn add(self, other: &Field<E>) -> <Field<E> as Add<&Field<E>>>::Output

Returns the sum of self and other.

§

type Output = Field<E>

The resulting type after applying the + operator.
§

impl<E> Add<Field<E>> for Field<E>where E: Environment,

§

fn add(self, other: Field<E>) -> <Field<E> as Add<Field<E>>>::Output

Returns the sum of self and other.

§

type Output = Field<E>

The resulting type after applying the + operator.
§

impl<E> AddAssign<&Field<E>> for Field<E>where E: Environment,

§

fn add_assign(&mut self, other: &Field<E>)

Adds other to self.

§

impl<E> AddAssign<Field<E>> for Field<E>where E: Environment,

§

fn add_assign(&mut self, other: Field<E>)

Adds other to self.

§

impl<E> Clone for Field<E>where E: Clone + Environment, <E as Environment>::Field: Clone,

§

fn clone(&self) -> Field<E>

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
§

impl<E> Compare<Field<E>> for Field<E>where E: Environment,

§

fn is_less_than( &self, other: &Field<E> ) -> <Field<E> as Compare<Field<E>>>::Output

Returns true if self is less than other.

§

fn is_greater_than( &self, other: &Field<E> ) -> <Field<E> as Compare<Field<E>>>::Output

Returns true if self is greater than other.

§

fn is_less_than_or_equal( &self, other: &Field<E> ) -> <Field<E> as Compare<Field<E>>>::Output

Returns true if self is less than or equal to other.

§

fn is_greater_than_or_equal( &self, other: &Field<E> ) -> <Field<E> as Compare<Field<E>>>::Output

Returns true if self is greater than or equal to other.

§

type Output = Boolean<E>

§

impl<E> Debug for Field<E>where E: Environment,

§

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

Formats the value using the given formatter. Read more
§

impl<E> Deref for Field<E>where E: Environment,

§

type Target = <E as Environment>::Field

The resulting type after dereferencing.
§

fn deref(&self) -> &<Field<E> as Deref>::Target

Dereferences the value.
§

impl<E> DerefMut for Field<E>where E: Environment,

§

fn deref_mut(&mut self) -> &mut <Field<E> as Deref>::Target

Mutably dereferences the value.
§

impl<'de, E> Deserialize<'de> for Field<E>where E: Environment,

§

fn deserialize<D>( deserializer: D ) -> Result<Field<E>, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

Deserializes the field from a string or bytes.

§

impl<E> Display for Field<E>where E: Environment,

§

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

Formats the value using the given formatter. Read more
§

impl<E> Distribution<Field<E>> for Standardwhere E: Environment,

§

fn sample<R>(&self, rng: &mut R) -> Field<E>where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
§

impl<E> Div<&Field<E>> for Field<E>where E: Environment,

§

fn div(self, other: &Field<E>) -> <Field<E> as Div<&Field<E>>>::Output

Returns the quotient of self and other.

§

type Output = Field<E>

The resulting type after applying the / operator.
§

impl<E> Div<Field<E>> for Field<E>where E: Environment,

§

fn div(self, other: Field<E>) -> <Field<E> as Div<Field<E>>>::Output

Returns the quotient of self and other.

§

type Output = Field<E>

The resulting type after applying the / operator.
§

impl<E> DivAssign<&Field<E>> for Field<E>where E: Environment,

§

fn div_assign(&mut self, other: &Field<E>)

Divides self by other.

§

impl<E> DivAssign<Field<E>> for Field<E>where E: Environment,

§

fn div_assign(&mut self, other: Field<E>)

Divides self by other.

§

impl<E> Double for Field<E>where E: Environment,

§

fn double(&self) -> <Field<E> as Double>::Output

Returns the double of self.

§

type Output = Field<E>

§

impl<E> Equal<Field<E>> for Field<E>where E: Environment,

§

fn is_equal(&self, other: &Field<E>) -> <Field<E> as Equal<Field<E>>>::Output

Returns true if self and other are equal.

§

fn is_not_equal( &self, other: &Field<E> ) -> <Field<E> as Equal<Field<E>>>::Output

Returns true if self and other are not equal.

§

type Output = Boolean<E>

§

impl<E> FromBits for Field<E>where E: Environment,

§

fn from_bits_le(bits_le: &[bool]) -> Result<Field<E>, Error>

Initializes a new field from a list of little-endian bits.

  • If bits_le is longer than E::Field::size_in_bits(), the excess bits are enforced to be 0s.
  • If bits_le is shorter than E::Field::size_in_bits(), it is padded with 0s up to field size.
§

fn from_bits_be(bits_be: &[bool]) -> Result<Field<E>, Error>

Initializes a new field from a list of big-endian bits without leading zeros.

§

impl<E> FromBytes for Field<E>where E: Environment,

§

fn read_le<R>(reader: R) -> Result<Field<E>, Error>where R: Read,

Reads the field from a buffer.

source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where Self: Sized,

Returns Self from a byte array in little-endian order.
§

impl<E> FromStr for Field<E>where E: Environment,

§

fn from_str(string: &str) -> Result<Field<E>, Error>

Parses a string into a field.

§

type Err = Error

The associated error which can be returned from parsing.
§

impl<E> Hash for Field<E>where E: Hash + Environment, <E as Environment>::Field: Hash,

§

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
§

impl<E> Inverse for Field<E>where E: Environment,

§

fn inverse(&self) -> Result<<Field<E> as Inverse>::Output, Error>

Returns the inverse of self.

§

type Output = Field<E>

§

impl<E> Mul<&Field<E>> for Field<E>where E: Environment,

§

fn mul(self, other: &Field<E>) -> <Field<E> as Mul<&Field<E>>>::Output

Returns the product of self and other.

§

type Output = Field<E>

The resulting type after applying the * operator.
§

impl<E> Mul<Field<E>> for Field<E>where E: Environment,

§

fn mul(self, other: Field<E>) -> <Field<E> as Mul<Field<E>>>::Output

Returns the product of self and other.

§

type Output = Field<E>

The resulting type after applying the * operator.
§

impl<E> MulAssign<&Field<E>> for Field<E>where E: Environment,

§

fn mul_assign(&mut self, other: &Field<E>)

Multiplies self by other.

§

impl<E> MulAssign<Field<E>> for Field<E>where E: Environment,

§

fn mul_assign(&mut self, other: Field<E>)

Multiplies self by other.

§

impl<E> Neg for Field<E>where E: Environment,

§

fn neg(self) -> <Field<E> as Neg>::Output

Returns the negation of self.

§

type Output = Field<E>

The resulting type after applying the - operator.
§

impl<E> One for Field<E>where E: Environment,

§

fn one() -> Field<E>

Returns the 1 element of the field.

§

fn is_one(&self) -> bool

Returns true if the element is one.

source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
§

impl<E> Ord for Field<E>where E: Environment,

§

fn cmp(&self, other: &Field<E>) -> Ordering

Returns the lexicographic ordering of self and other.

1.21.0 · source§

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
§

impl<E> Parser for Field<E>where E: Environment,

§

fn parse(string: &str) -> Result<(&str, Field<E>), Err<VerboseError<&str>>>

Parses a string into a field circuit.

§

impl<E> PartialEq<Field<E>> for Field<E>where E: PartialEq<E> + Environment, <E as Environment>::Field: PartialEq<<E as Environment>::Field>,

§

fn eq(&self, other: &Field<E>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<E> PartialOrd<Field<E>> for Field<E>where E: Environment,

§

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

Returns the lexicographic ordering of self and other.

1.0.0 · source§

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

This method 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

This method 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

This method 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

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

impl<E> Pow<&Field<E>> for Field<E>where E: Environment,

§

fn pow(self, other: &Field<E>) -> <Field<E> as Pow<&Field<E>>>::Output

Returns the power of self to the power of other.

§

type Output = Field<E>

The result after applying the operator.
§

impl<E> Pow<Field<E>> for Field<E>where E: Environment,

§

fn pow(self, other: Field<E>) -> <Field<E> as Pow<Field<E>>>::Output

Returns the power of self to the power of other.

§

type Output = Field<E>

The result after applying the operator.
§

impl<'a, E> Product<&'a Field<E>> for Field<E>where E: Environment,

§

fn product<I>(iter: I) -> Field<E>where I: Iterator<Item = &'a Field<E>>,

Returns the product of self and other.

§

impl<E> Product<Field<E>> for Field<E>where E: Environment,

§

fn product<I>(iter: I) -> Field<E>where I: Iterator<Item = Field<E>>,

Returns the product of self and other.

§

impl<E> Serialize for Field<E>where E: Environment,

§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

Serializes the field into a string or as bytes.

§

impl<E> SizeInBits for Field<E>where E: Environment,

§

fn size_in_bits() -> usize

Returns the field size in bits.

§

impl<E> SizeInBytes for Field<E>where E: Environment,

§

fn size_in_bytes() -> usize

Returns the field size in bytes.

§

impl<E> SizeInDataBits for Field<E>where E: Environment,

§

fn size_in_data_bits() -> usize

Returns the field capacity for data bits.

§

impl<E> Square for Field<E>where E: Environment,

§

fn square(&self) -> <Field<E> as Square>::Output

Returns the square of self.

§

type Output = Field<E>

§

impl<E> SquareRoot for Field<E>where E: Environment,

§

fn square_root(&self) -> Result<<Field<E> as SquareRoot>::Output, Error>

Returns the square_root of self.

§

type Output = Field<E>

§

impl<E> Sub<&Field<E>> for Field<E>where E: Environment,

§

fn sub(self, other: &Field<E>) -> <Field<E> as Sub<&Field<E>>>::Output

Returns the difference of self and other.

§

type Output = Field<E>

The resulting type after applying the - operator.
§

impl<E> Sub<Field<E>> for Field<E>where E: Environment,

§

fn sub(self, other: Field<E>) -> <Field<E> as Sub<Field<E>>>::Output

Returns the difference of self and other.

§

type Output = Field<E>

The resulting type after applying the - operator.
§

impl<E> SubAssign<&Field<E>> for Field<E>where E: Environment,

§

fn sub_assign(&mut self, other: &Field<E>)

Subtracts other from self.

§

impl<E> SubAssign<Field<E>> for Field<E>where E: Environment,

§

fn sub_assign(&mut self, other: Field<E>)

Subtracts other from self.

§

impl<'a, E> Sum<&'a Field<E>> for Field<E>where E: Environment,

§

fn sum<I>(iter: I) -> Field<E>where I: Iterator<Item = &'a Field<E>>,

Returns the sum of self and other.

§

impl<E> Sum<Field<E>> for Field<E>where E: Environment,

§

fn sum<I>(iter: I) -> Field<E>where I: Iterator<Item = Field<E>>,

Returns the sum of self and other.

§

impl<E> Ternary for Field<E>where E: Environment,

§

fn ternary( condition: &<Field<E> as Ternary>::Boolean, first: &Field<E>, second: &Field<E> ) -> <Field<E> as Ternary>::Output

Returns first if condition is true, otherwise returns second.

§

type Boolean = Boolean<E>

§

type Output = Field<E>

§

impl<E> ToBits for Field<E>where E: Environment,

§

fn to_bits_le(&self) -> Vec<bool, Global>

Outputs the little-endian bit representation of self without trailing zeros.

§

fn to_bits_be(&self) -> Vec<bool, Global>

Outputs the big-endian bit representation of self without leading zeros.

§

impl<E> ToBytes for Field<E>where E: Environment,

§

fn write_le<W>(&self, writer: W) -> Result<(), Error>where W: Write,

Writes the field to a buffer.

source§

fn to_bytes_le(&self) -> Result<Vec<u8, Global>, Error>where Self: Sized,

Returns self as a byte array in little-endian order.
§

impl<E> TypeName for Field<E>where E: Environment,

§

fn type_name() -> &'static str

Returns the type name as a string.

§

impl<E> Zero for Field<E>where E: Environment,

§

fn zero() -> Field<E>

Returns the 0 element of the field.

§

fn is_zero(&self) -> bool

Returns true if the element is zero.

source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
§

impl<E> Copy for Field<E>where E: Copy + Environment, <E as Environment>::Field: Copy,

§

impl<E> Eq for Field<E>where E: Eq + Environment, <E as Environment>::Field: Eq,

§

impl<E> FieldTrait for Field<E>where E: Environment,

§

impl<E> StructuralEq for Field<E>where E: Environment,

§

impl<E> StructuralPartialEq for Field<E>where E: Environment,

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for Field<E>where <E as Environment>::Field: RefUnwindSafe,

§

impl<E> Send for Field<E>

§

impl<E> Sync for Field<E>

§

impl<E> Unpin for Field<E>where <E as Environment>::Field: Unpin,

§

impl<E> UnwindSafe for Field<E>where <E as Environment>::Field: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<'de, T> DeserializeExt<'de> for Twhere T: DeserializeOwned,

source§

fn take_from_value<D>( value: &mut Value, field: &str ) -> Result<T, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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> Uniform for Twhere Standard: Distribution<T>,

source§

fn rand<R>(rng: &mut R) -> Twhere R: Rng + ?Sized,

Samples a random value from a uniform distribution.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,