pub struct ForeignElement<F: Field, const B: usize, const N: usize> {
pub limbs: [F; N],
len: usize,
}Expand description
Represents a foreign field element Represents a foreign field element
Fields§
§limbs: [F; N]limbs in little endian order
len: usizenumber of limbs used for the foreign field element
Implementations§
Source§impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N>
impl<F: Field, const B: usize, const N: usize> ForeignElement<F, B, N>
Sourcepub const fn new(limbs: [F; N]) -> Self
pub const fn new(limbs: [F; N]) -> Self
Creates a new foreign element from an array containing N limbs
Sourcepub fn from_biguint(big: &BigUint) -> Self
pub fn from_biguint(big: &BigUint) -> Self
Sourcepub fn neg(&self, modulus: &BigUint) -> Self
pub fn neg(&self, modulus: &BigUint) -> Self
Initializes a new foreign element from an absolute BigUint but the equivalent
foreign element obtained corresponds to the negated input. It first converts the
input big element to a big integer modulo the foreign field modulus, and then
computes the negation of the result.
Sourcepub fn from_be(bytes: &[u8]) -> Self
pub fn from_be(bytes: &[u8]) -> Self
Initializes a new foreign element from a set of bytes in big endian
Sourcepub fn to_biguint(&self) -> BigUint
pub fn to_biguint(&self) -> BigUint
Obtains the big integer representation of the foreign field element
Sourcefn big_to_vec(fe: &BigUint) -> Vec<F>
fn big_to_vec(fe: &BigUint) -> Vec<F>
Split a foreign field element into a vector of B (limb bitsize) bits field
elements of type F in little-endian. Right now it is written
so that it gives N (limb count) limbs, even if it fits in less bits.
Source§impl<F: PrimeField, const B: usize, const N: usize> ForeignElement<F, B, N>
impl<F: PrimeField, const B: usize, const N: usize> ForeignElement<F, B, N>
Sourcepub fn from_field(field: F) -> Self
pub fn from_field(field: F) -> Self
Initializes a new foreign element from an element in the native field
Trait Implementations§
Source§impl<F: Clone + Field, const B: usize, const N: usize> Clone for ForeignElement<F, B, N>
impl<F: Clone + Field, const B: usize, const N: usize> Clone for ForeignElement<F, B, N>
Source§fn clone(&self) -> ForeignElement<F, B, N>
fn clone(&self) -> ForeignElement<F, B, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Field, const B: usize, const N: usize> ForeignFieldHelpers<F, B> for ForeignElement<F, B, N>
impl<F: Field, const B: usize, const N: usize> ForeignFieldHelpers<F, B> for ForeignElement<F, B, N>
Source§fn two_to_limb() -> F
fn two_to_limb() -> F
Source§fn two_to_2limb() -> F
fn two_to_2limb() -> F
Source§fn two_to_3limb() -> F
fn two_to_3limb() -> F
Source§impl<F: PartialEq + Field, const B: usize, const N: usize> PartialEq for ForeignElement<F, B, N>
impl<F: PartialEq + Field, const B: usize, const N: usize> PartialEq for ForeignElement<F, B, N>
impl<F: Eq + Field, const B: usize, const N: usize> Eq for ForeignElement<F, B, N>
impl<F: Field, const B: usize, const N: usize> StructuralPartialEq for ForeignElement<F, B, N>
Auto Trait Implementations§
impl<F, const B: usize, const N: usize> Freeze for ForeignElement<F, B, N>where
F: Freeze,
impl<F, const B: usize, const N: usize> RefUnwindSafe for ForeignElement<F, B, N>where
F: RefUnwindSafe,
impl<F, const B: usize, const N: usize> Send for ForeignElement<F, B, N>
impl<F, const B: usize, const N: usize> Sync for ForeignElement<F, B, N>
impl<F, const B: usize, const N: usize> Unpin for ForeignElement<F, B, N>where
F: Unpin,
impl<F, const B: usize, const N: usize> UnsafeUnpin for ForeignElement<F, B, N>where
F: UnsafeUnpin,
impl<F, const B: usize, const N: usize> UnwindSafe for ForeignElement<F, B, N>where
F: 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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.