Struct twenty_first::shared_math::b_field_element::BFieldElement
source · [−]pub struct BFieldElement(_);
Implementations
sourceimpl BFieldElement
impl BFieldElement
pub const QUOTIENT: u64 = 18_446_744_069_414_584_321u64
pub const MAX: u64 = 18_446_744_069_414_584_320u64
pub const fn new(value: u64) -> Self
pub fn value(&self) -> u64
sourcepub fn power_accumulator<const N: usize, const M: usize>(
base: [Self; N],
tail: [Self; N]
) -> [Self; N]
pub fn power_accumulator<const N: usize, const M: usize>(
base: [Self; N],
tail: [Self; N]
) -> [Self; N]
Square the base M times and multiply the result by the tail value
pub fn lift(&self) -> XFieldElement
pub fn increment(&mut self)
pub fn decrement(&mut self)
pub const fn ring_zero() -> Self
pub const fn ring_one() -> Self
pub fn mod_pow(&self, exp: u64) -> Self
pub fn legendre_symbol(&self) -> i8
Trait Implementations
sourceimpl Add<BFieldElement> for BFieldElement
impl Add<BFieldElement> for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the +
operator.
sourceimpl AddAssign<BFieldElement> for BFieldElement
impl AddAssign<BFieldElement> for BFieldElement
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl Clone for BFieldElement
impl Clone for BFieldElement
sourcefn clone(&self) -> BFieldElement
fn clone(&self) -> BFieldElement
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl CyclicGroupGenerator for BFieldElement
impl CyclicGroupGenerator for BFieldElement
fn get_cyclic_group_elements(&self, max: Option<usize>) -> Vec<Self>
sourceimpl Debug for BFieldElement
impl Debug for BFieldElement
sourceimpl Default for BFieldElement
impl Default for BFieldElement
sourcefn default() -> BFieldElement
fn default() -> BFieldElement
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for BFieldElement
impl<'de> Deserialize<'de> for BFieldElement
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for BFieldElement
impl Display for BFieldElement
sourceimpl Div<BFieldElement> for BFieldElement
impl Div<BFieldElement> for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the /
operator.
sourceimpl From<&BFieldElement> for u64
impl From<&BFieldElement> for u64
sourcefn from(elem: &BFieldElement) -> Self
fn from(elem: &BFieldElement) -> Self
Converts to this type from the input type.
sourceimpl From<BFieldElement> for [u8; 8]
impl From<BFieldElement> for [u8; 8]
Convert a B-field element to a byte array. The client uses this for its database.
sourcefn from(bfe: BFieldElement) -> Self
fn from(bfe: BFieldElement) -> Self
Converts to this type from the input type.
sourceimpl From<BFieldElement> for u64
impl From<BFieldElement> for u64
sourcefn from(elem: BFieldElement) -> Self
fn from(elem: BFieldElement) -> Self
Converts to this type from the input type.
sourceimpl From<u32> for BFieldElement
impl From<u32> for BFieldElement
sourceimpl FromVecu8 for BFieldElement
impl FromVecu8 for BFieldElement
fn from_vecu8(&self, bytes: Vec<u8>) -> Self
sourceimpl GetPrimitiveRootOfUnity for BFieldElement
impl GetPrimitiveRootOfUnity for BFieldElement
fn get_primitive_root_of_unity(
&self,
n: u64
) -> (Option<BFieldElement>, Vec<u64>)
sourceimpl GetRandomElements for BFieldElement
impl GetRandomElements for BFieldElement
sourceimpl Hash for BFieldElement
impl Hash for BFieldElement
sourceimpl IdentityValues for BFieldElement
impl IdentityValues for BFieldElement
sourceimpl Inverse for BFieldElement
impl Inverse for BFieldElement
sourceimpl ModPowU32 for BFieldElement
impl ModPowU32 for BFieldElement
fn mod_pow_u32(&self, exp: u32) -> Self
sourceimpl ModPowU64 for BFieldElement
impl ModPowU64 for BFieldElement
fn mod_pow_u64(&self, pow: u64) -> Self
sourceimpl Mul<BFieldElement> for BFieldElement
impl Mul<BFieldElement> for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the *
operator.
sourceimpl MulAssign<BFieldElement> for BFieldElement
impl MulAssign<BFieldElement> for BFieldElement
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *=
operation. Read more
sourceimpl Neg for BFieldElement
impl Neg for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the -
operator.
sourceimpl New for BFieldElement
impl New for BFieldElement
fn new_from_usize(&self, value: usize) -> Self
sourceimpl PartialEq<BFieldElement> for BFieldElement
impl PartialEq<BFieldElement> for BFieldElement
sourceimpl PrimeField for BFieldElement
impl PrimeField for BFieldElement
sourceimpl Rem<BFieldElement> for BFieldElement
impl Rem<BFieldElement> for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the %
operator.
sourceimpl Serialize for BFieldElement
impl Serialize for BFieldElement
sourceimpl Sub<BFieldElement> for BFieldElement
impl Sub<BFieldElement> for BFieldElement
type Output = BFieldElement
type Output = BFieldElement
The resulting type after applying the -
operator.
sourceimpl SubAssign<BFieldElement> for BFieldElement
impl SubAssign<BFieldElement> for BFieldElement
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
sourceimpl Sum<BFieldElement> for BFieldElement
impl Sum<BFieldElement> for BFieldElement
sourceimpl ToDigest<Blake3Hash> for BFieldElement
impl ToDigest<Blake3Hash> for BFieldElement
fn to_digest(&self) -> Blake3Hash
sourceimpl ToDigest<Vec<BFieldElement, Global>> for BFieldElement
impl ToDigest<Vec<BFieldElement, Global>> for BFieldElement
Trivial implementation when hashing Vec<BFieldElement>
into BFieldElement
.
fn to_digest(&self) -> Vec<BFieldElement>
sourceimpl TryFrom<BFieldElement> for u32
impl TryFrom<BFieldElement> for u32
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourcefn try_from(value: BFieldElement) -> Result<Self, Self::Error>
fn try_from(value: BFieldElement) -> Result<Self, Self::Error>
Performs the conversion.
impl Copy for BFieldElement
impl Eq for BFieldElement
Auto Trait Implementations
impl RefUnwindSafe for BFieldElement
impl Send for BFieldElement
impl Sync for BFieldElement
impl Unpin for BFieldElement
impl UnwindSafe for BFieldElement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more