add apply
bendn 2025-02-03
parent e551a4a · commit 513ef89
-rw-r--r--Cargo.lock6
-rw-r--r--Cargo.toml4
-rw-r--r--src/lib.rs13
3 files changed, 17 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index de5b76c..3406dd1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,16 +4,16 @@ version = 3
[[package]]
name = "lower"
-version = "0.1.4"
+version = "0.2.0"
dependencies = [
"lower-macros",
]
[[package]]
name = "lower-macros"
-version = "0.1.1"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "383823c24b2a094a6a9de418eba3b60bf8186b688e74e4a20ba5321dfae04fba"
+checksum = "f0b43ed50f1f56bf1dedc1c8977b61394c9a970db3707c8b8b8ff81ac1b46d83"
dependencies = [
"proc-macro2",
"quote",
diff --git a/Cargo.toml b/Cargo.toml
index 34542dc..c042a76 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lower"
-version = "0.1.4"
+version = "0.2.0"
authors = ["bend-n <[email protected]>"]
description = "desugar math where the compiler wont"
edition = "2021"
@@ -10,4 +10,4 @@ keywrords = ["fast", "math", "float"]
categories = ["hardware-support", "mathematics"]
[dependencies]
-lower-macros = "0.1.1"
+lower-macros = "0.2"
diff --git a/src/lib.rs b/src/lib.rs
index 8634a21..358bf68 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,6 +23,18 @@ pub mod fast {
pub use lower_macros::fast as math;
}
+/// Applys the macro to your stmts.
+/// Argument can be `algebraic` | `fast` | `basic` | none
+/// ```
+/// # #![feature(core_intrinsics)]
+/// #[lower::apply(algebraic)]
+/// fn madd(a: f32, b: f32, c: f32) -> f32 {
+/// a * b + c
+/// }
+/// ```
+/// Enaables nicer formatting and better rust analyzer integration.
+pub use lower_macros::apply;
+
/// Lower math to method calls. Only useful if you define the functions.
/// ```
/// # use std::ops::*;
@@ -31,5 +43,4 @@ pub mod fast {
/// // expands to
/// // a.mul((&b).deref()).add(c.neg())
/// ```
-/// <p style="display: none">
pub use lower_macros::math;