pub struct Zq { /* private fields */ }
Expand description
Element of the group Z/(2^32 − 1). Uses native u32 operations with automatic modulo reduction through wrapping arithmetic.
Implementations§
Source§impl Zq
impl Zq
pub const ZERO: Self
pub const ONE: Self
pub const TWO: Self
pub const NEG_ONE: Self
Sourcepub const fn new(value: u32) -> Self
pub const fn new(value: u32) -> Self
Creates a new Zq element from a raw u32 value. No explicit modulo needed as u32 automatically wraps
pub fn to_u128(&self) -> u128
pub fn get_value(&self) -> u32
pub const fn is_zero(&self) -> bool
Sourcepub fn is_larger_than_half(&self) -> bool
pub fn is_larger_than_half(&self) -> bool
Returns 1
iff the element is in (q-1/2, q)
Trait Implementations§
Source§impl AddAssign for Zq
impl AddAssign for Zq
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl MulAssign for Zq
impl MulAssign for Zq
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl Ord for Zq
impl Ord for Zq
Source§impl PartialOrd for Zq
impl PartialOrd for Zq
Source§impl SampleUniform for Zq
impl SampleUniform for Zq
Source§impl SubAssign for Zq
impl SubAssign for Zq
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for Zq
impl Eq for Zq
impl StructuralPartialEq for Zq
Auto Trait Implementations§
impl Freeze for Zq
impl RefUnwindSafe for Zq
impl Send for Zq
impl Sync for Zq
impl Unpin for Zq
impl UnwindSafe for Zq
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
Source§fn borrow(&self) -> &Borrowed
fn borrow(&self) -> &Borrowed
Immutably borrows from an owned value. See
Borrow::borrow