#num-traits #ff #derive #macro-derive #prime-field #derived #associated

macro ff-derive-num

Procedural macro library to add the Num trait to Field implementations for ff

4 releases

0.2.0 Mar 10, 2022
0.1.2 Jun 12, 2021
0.1.1 Jun 12, 2021
0.1.0 Jun 12, 2021

#12 in #num-traits

Download history 25/week @ 2024-03-11 10/week @ 2024-03-18 6/week @ 2024-03-25 34/week @ 2024-04-01 14/week @ 2024-04-08 18/week @ 2024-04-15 21/week @ 2024-04-22 10/week @ 2024-04-29 18/week @ 2024-05-06 13/week @ 2024-05-13 25/week @ 2024-05-20 15/week @ 2024-05-27 29/week @ 2024-06-03 24/week @ 2024-06-10 25/week @ 2024-06-17 19/week @ 2024-06-24

99 downloads per month
Used in 3 crates (via lcpc-test-fields)

MIT/Apache

8KB
112 lines

ff-derive-num

This crate provides a derive macro for num-traits::Num and associated traits for ff::Field implementations derived with the ff-derive crate.

example

use ff::PrimeField;         // ff should be used with the "derive" feature!
use ff_derive_num::Num;

#[derive(PrimeField,Num)]
#[PrimeFieldModulus = "70386805592835581672624750593"]
#[PrimeFieldGenerator = "17"]
#[PrimeFieldReprEndianness = "little"]
pub struct Ft([u64; 2]);

license

Copyright 2021 Riad S. Wahby

You may choose either the Apache-2.0 license or the MIT license.

Unless you explicitly state otherwise, any contribution you submit will also be dual-licensed.


lib.rs:

Derive ::num_traits::Num and associated traits for ::ff::Field types derived using ::ff_derive

example

use ff::PrimeField;         // ff should be used with the "derive" feature!
use ff_derive_num::Num;

#[derive(PrimeField,Num)]
#[PrimeFieldModulus = "70386805592835581672624750593"]
#[PrimeFieldGenerator = "17"]
#[PrimeFieldReprEndianness = "little"]
pub struct Ft([u64; 2]);

Dependencies

~1.5MB
~38K SLoC