From 48d4f4c956b40b8d5339f4e12ce6aab64d671128 Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Fri, 9 Aug 2024 10:58:05 +0200 Subject: [PATCH] Redesign the features --- Cargo.toml | 5 +++-- Makefile | 12 ++++++------ src/primitive/mod.rs | 8 ++++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0c3c797f..ae401656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,10 +24,11 @@ keywords = ["beta", "error", "gamma"] [features] default = ["no_std"] -no_std = [] +no_std = ["lambert_w/libm"] +std = ["lambert_w/std"] [dependencies] -lambert_w = { version = "0.5.2", default-features = false, features = ["50bits", "libm"] } +lambert_w = { version = "0.5.2", default-features = false, features = ["50bits"] } libm = "0.2" [dev-dependencies] diff --git a/Makefile b/Makefile index 9b986335..70b163f4 100644 --- a/Makefile +++ b/Makefile @@ -3,16 +3,16 @@ all: check test .PHONY: test bench: - cargo +nightly bench - cargo +nightly bench --no-default-features + cargo +nightly bench --no-default-features --features no_std + cargo +nightly bench --no-default-features --features std .PHONY: check check: - cargo clippy -- -D warnings - cargo clippy --no-default-features -- -D warnings + cargo clippy --no-default-features --features no_std -- -D warnings + cargo clippy --no-default-features --features std -- -D warnings cargo fmt --all -- --check .PHONY: test test: - cargo test - cargo test --no-default-features + cargo test --no-default-features --features no_std + cargo test --no-default-features --features std diff --git a/src/primitive/mod.rs b/src/primitive/mod.rs index b31ff9ed..67a22a1e 100644 --- a/src/primitive/mod.rs +++ b/src/primitive/mod.rs @@ -28,8 +28,12 @@ macro_rules! implement { } } -#[cfg_attr(feature = "no_std", path = "extrinsic.rs")] -#[cfg_attr(not(feature = "no_std"), path = "intrinsic.rs")] +#[cfg(feature = "no_std")] +#[path = "extrinsic.rs"] +mod implementation; + +#[cfg(feature = "std")] +#[path = "intrinsic.rs"] mod implementation; pub use implementation::Primitive;