From 69ce66ae6cf43755e7fd5eea75f6945d0fa6ac2b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 2 Jul 2018 21:08:24 +0100 Subject: [PATCH] Place ff_derive re-exports behind a feature Part of #3. --- Cargo.toml | 2 +- README.md | 9 +++++++++ src/lib.rs | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d2af3deca..5f34fa040 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,6 @@ rand = "0.4" ff_derive = { version = "0.3.0", path = "ff_derive", optional = true } [features] -default = ["derive"] +default = [] u128-support = [] derive = ["ff_derive"] diff --git a/README.md b/README.md index d08329e60..ae676c162 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,15 @@ The `ff` crate contains `Field`, `PrimeField`, `PrimeFieldRepr` and `SqrtField` If you need an implementation of a prime field, this library also provides a procedural macro that will expand into an efficient implementation of a prime field when supplied with the modulus. `PrimeFieldGenerator` must be an element of Fp of p-1 order, that is also quadratic nonresidue. +First, enable the `derive` crate feature: + +```toml +[dependencies] +ff = { version = "0.3", features = ["derive"] } +``` + +And then use the macro like so: + ```rust extern crate rand; #[macro_use] diff --git a/src/lib.rs b/src/lib.rs index 541fe76a2..d79bc146f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,9 +3,11 @@ extern crate byteorder; extern crate rand; +#[cfg(feature = "derive")] #[macro_use] extern crate ff_derive; +#[cfg(feature = "derive")] pub use ff_derive::*; use std::error::Error;