pub trait Element:
    Clone
    + Eq
    + PartialEq
    + Send
    + Sync {
    // Required methods
    fn zero() -> Self;
    fn one() -> Self;
    fn add(&mut self, rhs: &Self);
    fn mul(&mut self, rhs: &Scalar);
    fn serialize(&self) -> Vec<u8> ;
    fn size() -> usize;
    fn deserialize(bytes: &[u8]) -> Option<Self>;
}
Expand description

An element of a group.

Required Methods§

Source

fn zero() -> Self

Returns the additive identity.

Source

fn one() -> Self

Returns the multiplicative identity.

Source

fn add(&mut self, rhs: &Self)

Adds to self in-place.

Source

fn mul(&mut self, rhs: &Scalar)

Multiplies self in-place.

Source

fn serialize(&self) -> Vec<u8>

Canonically serializes the element.

Source

fn size() -> usize

Serialized size of the element.

Source

fn deserialize(bytes: &[u8]) -> Option<Self>

Deserializes an untrusted, canonically-encoded element.

This function performs any validation necessary to ensure the decoded element is valid (like an infinity or group check).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§