Skip to content

Simplify creating types from bytes (remove default()/copy_from_slice()/from_repr()) #2

@conradoplg

Description

@conradoplg

To create certain types from bytes we need to go through a bunch of steps, e.g.

let mut repr = <S::Scalar as PrimeField>::Repr::default();
repr.as_mut().copy_from_slice(&s_bytes);
let maybe_scalar = S::Scalar::from_repr(repr);

It seems this could be improved by const_evaluatable_checked which has not stabilized yet. Check if that is the best solution or if there is an alternative, and implement it if possible.

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