pub struct Poly<C>(/* private fields */);Expand description
A polynomial that is using a scalar for the variable x and a generic element for the coefficients.
The coefficients must be able to multiply the type of the variable, which is always a scalar.
Implementations§
Source§impl<C: Element> Poly<C>
impl<C: Element> Poly<C>
Sourcepub fn commit(commits: Poly<Scalar>) -> Self
pub fn commit(commits: Poly<Scalar>) -> Self
Commits the scalar polynomial to the group and returns a polynomial over the group.
This is done by multiplying each coefficient of the polynomial with the group’s generator.
Sourcepub fn get(&self, i: u32) -> C
pub fn get(&self, i: u32) -> C
Returns the given coefficient at the requested index.
It panics if the index is out of range.
Sourcepub fn set(&mut self, index: u32, value: C)
pub fn set(&mut self, index: u32, value: C)
Set the given element at the specified index.
It panics if the index is out of range.
Sourcepub fn deserialize(bytes: &[u8], expected: u32) -> Option<Self>
pub fn deserialize(bytes: &[u8], expected: u32) -> Option<Self>
Deserializes a canonically encoded polynomial.
Trait Implementations§
impl<C: Eq> Eq for Poly<C>
impl<C> StructuralPartialEq for Poly<C>
Auto Trait Implementations§
impl<C> Freeze for Poly<C>
impl<C> RefUnwindSafe for Poly<C>where
C: RefUnwindSafe,
impl<C> Send for Poly<C>where
C: Send,
impl<C> Sync for Poly<C>where
C: Sync,
impl<C> Unpin for Poly<C>where
C: Unpin,
impl<C> UnwindSafe for Poly<C>where
C: 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
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<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>
Converts
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>
Converts
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