Skip to content

Consider promoting Field::{zero, one} to associated constants #87

@tarcieri

Description

@tarcieri

Right now Field::zero() and Field::one() are static methods of the Field trait.

If they were instead associated constants, e.g. Field::ZERO/Field::ONE, they can be used in const contexts such as defining other constants:

pub struct ProjectivePoint<Fe: Field> { x: Fe, y: Fe, z: Fe }

impl<Fe: Field> ProjectivePoint<Fe> {
    pub const IDENTITY: Self = Self {
        x: Fe::ZERO,
        y: Fe::ONE,
        z: Fe::ZERO,
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions