Struct Point

Source
pub struct Point<E: Curve>(/* private fields */);
Expand description

Torsion-free point on elliptic curve E

Any instance of Point is guaranteed to be on curve E and free of torsion component. Note that identity point (sometimes called point at infinity) is a valid point that can be obtained by calling Point::zero().

Point implements all necessary arithmetic operations: points addition, multiplication at scalar, etc.

Implementations§

Source§

impl<E: Curve> Point<E>

Source

pub fn double(&self) -> Self

Doubles the point, returns self + self

point.double() may be more efficient than point + point or 2 * point

Source§

impl<E: Curve> Point<E>

Source

pub fn generator() -> Generator<E>

Curve generator

Curve generator is a regular point defined in curve specs. See Generator<E>.

Source

pub fn zero() -> Self

Returns identity point $\O$ (sometimes called as point at infinity)

Identity point has special properties:

$$\forall P \in \G: P + \O = P$$ $$\forall s \in \Zq: s \cdot \O = \O$$

When you validate input from user or message received on wire, you should bear in mind that any Point<E> may be zero. If your algorithm does not accept identity points, you may check whether point is zero by calling .is_zero(). Alternatively, you may accept NonZero<Point<E>> instead, which is guaranteed to be non zero.

Source

pub fn is_zero(&self) -> bool

Indicates whether it’s identity point

use generic_ec::{Point, curves::Secp256k1};

assert!(Point::<Secp256k1>::zero().is_zero());
assert!(!Point::<Secp256k1>::generator().to_point().is_zero());
Source

pub fn ct_is_zero(&self) -> Choice

Indicates whether it’s identity point (in constant time)

Same as .is_zero() but performs constant-time comparison.

Source

pub fn to_bytes(&self, compressed: bool) -> EncodedPoint<E>

Encodes a point as bytes

Function can return both compressed and uncompressed bytes representation of a point. Compressed bytes representation is more compact, but parsing takes a little bit more time. On other hand, uncompressed representation takes ~twice more space, but parsing is instant.

For some curves, compressed parameter may be ignored, and same bytes representation is returned.

use generic_ec::{Point, Scalar, curves::Secp256k1};
use rand::rngs::OsRng;

let random_point = Point::<Secp256k1>::generator() * Scalar::random(&mut OsRng);
let point_bytes = random_point.to_bytes(false);
let point_decoded = Point::from_bytes(&point_bytes)?;
assert_eq!(random_point, point_decoded);
Source

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self, InvalidPoint>

Decodes a point from bytes

Source

pub fn serialized_len(compressed: bool) -> usize

Returns size of bytes buffer that can fit a serialized point

compressed parameter has the same meaning as for Point::to_bytes; a buffer created with length of Point::serialized_len(compress) would fit exactly the serialization p.to_bytes(compress).

Trait Implementations§

Source§

impl<E: Curve> Add<&Generator<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Generator<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Generator<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Generator<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&NonZero<Point<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&NonZero<Point<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<&Point<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Generator<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Generator<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Generator<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Generator<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<Point<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<NonZero<Point<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Point<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Point<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Point<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Point<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add<Point<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> Add for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point<E>) -> Self::Output

Performs the + operation. Read more
Source§

impl<E: Curve> AddAssign<&Generator<E>> for Point<E>

Source§

fn add_assign(&mut self, rhs: &Generator<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<&NonZero<Point<E>>> for Point<E>

Source§

fn add_assign(&mut self, rhs: &NonZero<Point<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<&Point<E>> for Point<E>

Source§

fn add_assign(&mut self, rhs: &Point<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<Generator<E>> for Point<E>

Source§

fn add_assign(&mut self, rhs: Generator<E>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign<NonZero<Point<E>>> for Point<E>

Source§

fn add_assign(&mut self, rhs: NonZero<Point<E>>)

Performs the += operation. Read more
Source§

impl<E: Curve> AddAssign for Point<E>

Source§

fn add_assign(&mut self, rhs: Point<E>)

Performs the += operation. Read more
Source§

impl<E> AlwaysHasAffineY<E> for Point<E>

Source§

fn y(&self) -> Coordinate<E>

Retrieves affine $y$ coordinate
Source§

impl<E> AlwaysHasAffineYAndSign<E> for Point<E>

Source§

fn y_and_sign(&self) -> (Sign, Coordinate<E>)

Retrieves affine $y$ coordinate and sign of $x$ coordinate
Source§

fn from_y_and_sign(x_sign: Sign, y: &Coordinate<E>) -> Option<Self>

Constructs point from its $y$ coordinate and sign of $x$ coordinate Read more
Source§

impl<E: Curve> AsRaw for Point<E>

Source§

type Raw = <E as Curve>::Point

Wrapped point/scalar
Source§

fn as_raw(&self) -> &E::Point

Returns reference to wrapped value
Source§

impl<E: Curve> AsRef<Point<E>> for Point<E>

Source§

fn as_ref(&self) -> &Point<E>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Clone + Curve> Clone for Point<E>
where E::Point: Clone,

Source§

fn clone(&self) -> Point<E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Curve> ConditionallySelectable for Point<E>

Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

impl<E: Curve> ConstantTimeEq for Point<E>

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<E: Curve> Debug for Point<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Default + Curve> Default for Point<E>
where E::Point: Default,

Source§

fn default() -> Point<E>

Returns the “default value” for a type. Read more
Source§

impl<'de, E: Curve> Deserialize<'de> for Point<E>

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'de, E: Curve> DeserializeAs<'de, Point<E>> for Compact

Available on crate feature serde only.
Source§

fn deserialize_as<D>(deserializer: D) -> Result<Point<E>, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
Source§

impl<E: Curve> Digestable for Point<E>

Available on crate feature udigest only.
Source§

fn unambiguously_encode<B>(&self, encoder: EncodeValue<'_, B>)
where B: Buffer,

Unambiguously encodes the value
Source§

impl<E: Curve> From<Generator<E>> for Point<E>

Source§

fn from(_: Generator<E>) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve> From<NonZero<Point<E>>> for Point<E>

Source§

fn from(point: NonZero<Point<E>>) -> Self

Converts to this type from the input type.
Source§

impl<E: Curve + NoInvalidPoints> FromRaw for Point<E>

Source§

fn from_raw(raw: Self::Raw) -> Self

Infallibly wraps raw value
Source§

impl<E> HasAffineX<E> for Point<E>
where E: HasAffineX + Curve,

Source§

fn x(&self) -> Option<Coordinate<E>>

Retrieves affine $x$ coordinate Read more
Source§

impl<E> HasAffineXAndParity<E> for Point<E>

Source§

fn x_and_parity(&self) -> Option<(Coordinate<E>, Parity)>

Retrieves affine $x$ coordinate and parity of $y$ coordinate Read more
Source§

fn from_x_and_parity(x: &Coordinate<E>, y_parity: Parity) -> Option<Self>

Constructs point from its $x$ coordinate and parity of $y$ coordinate Read more
Source§

impl<E> HasAffineXY<E> for Point<E>
where E: HasAffineXY + Curve,

Source§

fn coords(&self) -> Option<Coordinates<E>>

Retrieves affine $x, y$ coordinates Read more
Source§

fn from_coords(coords: &Coordinates<E>) -> Option<Self>

Constructs point from its $x, y$ coordinates Read more
Source§

impl<E> HasAffineY<E> for Point<E>
where E: HasAffineY + Curve,

Source§

fn y(&self) -> Option<Coordinate<E>>

Retrieves affine $y$ coordinate Read more
Source§

impl<E: Curve> Hash for Point<E>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E: Curve> IsZero for Point<E>

Source§

fn is_zero(&self) -> bool

Checks whether self is zero
Source§

impl<E: Curve> Mul<&NonZero<Scalar<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<Scalar<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<SecretScalar<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&NonZero<SecretScalar<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for &NonZero<Scalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for &SecretScalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for NonZero<Scalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Point<E>> for SecretScalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&Scalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&SecretScalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<&SecretScalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Scalar<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<Scalar<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<Scalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<SecretScalar<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<NonZero<SecretScalar<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NonZero<SecretScalar<E>>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for &NonZero<Scalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for &NonZero<SecretScalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for &Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for &SecretScalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for NonZero<Scalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for NonZero<SecretScalar<E>>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for Scalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Point<E>> for SecretScalar<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Point<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<Scalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<SecretScalar<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> Mul<SecretScalar<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SecretScalar<E>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Curve> MulAssign<&NonZero<Scalar<E>>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &NonZero<Scalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&NonZero<SecretScalar<E>>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &NonZero<SecretScalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&Scalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<&SecretScalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: &SecretScalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<NonZero<Scalar<E>>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: NonZero<Scalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<NonZero<SecretScalar<E>>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: NonZero<SecretScalar<E>>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<Scalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: Scalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> MulAssign<SecretScalar<E>> for Point<E>

Source§

fn mul_assign(&mut self, rhs: SecretScalar<E>)

Performs the *= operation. Read more
Source§

impl<E: Curve> Neg for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E: Curve> Neg for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<E: Curve> Ord for Point<E>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<E: Curve> PartialEq<NonZero<Point<E>>> for Point<E>

Source§

fn eq(&self, other: &NonZero<Point<E>>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: PartialEq + Curve> PartialEq for Point<E>
where E::Point: PartialEq,

Source§

fn eq(&self, other: &Point<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Curve> PartialOrd<NonZero<Point<E>>> for Point<E>

Source§

fn partial_cmp(&self, other: &NonZero<Point<E>>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<E: Curve> PartialOrd for Point<E>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<E: Curve> Serialize for Point<E>

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<E: Curve> SerializeAs<Point<E>> for Compact

Available on crate feature serde only.
Source§

fn serialize_as<S>(source: &Point<E>, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
Source§

impl<E: Curve> Sub<&Generator<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Generator<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Generator<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Generator<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&NonZero<Point<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&NonZero<Point<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NonZero<Point<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<&Point<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Generator<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Generator<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Generator<E>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Generator<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<Point<E>>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<NonZero<Point<E>>> for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NonZero<Point<E>>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Point<E>> for &Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Point<E>> for &NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Point<E>> for &Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Point<E>> for Generator<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub<Point<E>> for NonZero<Point<E>>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> Sub for Point<E>

Source§

type Output = Point<E>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point<E>) -> Self::Output

Performs the - operation. Read more
Source§

impl<E: Curve> SubAssign<&Generator<E>> for Point<E>

Source§

fn sub_assign(&mut self, rhs: &Generator<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<&NonZero<Point<E>>> for Point<E>

Source§

fn sub_assign(&mut self, rhs: &NonZero<Point<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<&Point<E>> for Point<E>

Source§

fn sub_assign(&mut self, rhs: &Point<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<Generator<E>> for Point<E>

Source§

fn sub_assign(&mut self, rhs: Generator<E>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign<NonZero<Point<E>>> for Point<E>

Source§

fn sub_assign(&mut self, rhs: NonZero<Point<E>>)

Performs the -= operation. Read more
Source§

impl<E: Curve> SubAssign for Point<E>

Source§

fn sub_assign(&mut self, rhs: Point<E>)

Performs the -= operation. Read more
Source§

impl<'s, E: Curve> Sum<&'s NonZero<Point<E>>> for Point<E>

Source§

fn sum<I: Iterator<Item = &'s NonZero<Point<E>>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'a, E: Curve> Sum<&'a Point<E>> for Point<E>

Source§

fn sum<I: Iterator<Item = &'a Point<E>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> Sum<NonZero<Point<E>>> for Point<E>

Source§

fn sum<I: Iterator<Item = NonZero<Point<E>>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> Sum for Point<E>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<E: Curve> TryFrom<Point<E>> for NonZero<Point<E>>

Source§

type Error = ZeroPoint

The type returned in the event of a conversion error.
Source§

fn try_from(point: Point<E>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<E: Curve> TryFromRaw for Point<E>

Source§

fn ct_try_from_raw(point: E::Point) -> CtOption<Self>

Wraps raw value (constant time) Read more
Source§

fn try_from_raw(raw: Self::Raw) -> Option<Self>

Wraps raw value Read more
Source§

impl<E: Curve> Zero for Point<E>

Source§

fn zero() -> Self

Constructs zero value of Self
Source§

fn is_zero(x: &Self) -> Choice

Checks (in constant-time) if x is zero
Source§

impl<E: Curve> Zeroize for Point<E>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<E: Copy + Curve> Copy for Point<E>
where E::Point: Copy,

Source§

impl<E: Eq + Curve> Eq for Point<E>
where E::Point: Eq,

Source§

impl<E: Curve> StructuralPartialEq for Point<E>

Auto Trait Implementations§

§

impl<E> Freeze for Point<E>
where <E as Curve>::Point: Freeze,

§

impl<E> RefUnwindSafe for Point<E>
where <E as Curve>::Point: RefUnwindSafe,

§

impl<E> Send for Point<E>

§

impl<E> Sync for Point<E>

§

impl<E> Unpin for Point<E>

§

impl<E> UnwindSafe for Point<E>
where <E as Curve>::Point: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConditionallyNegatable for T
where T: ConditionallySelectable, &'a T: for<'a> Neg<Output = T>,

Source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

Source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

Source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

Source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,