Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
macro_optim
macro_optim is a Rust procedural macro crate designed to optimize mathematical expressions with procedural macros, used for heavy mathematical computations, like rendering. It can handle addition and multiplication of integer and floating-point literals by evaluating them and replacing them with the result. It optimizes the code at compile time.
Features
- Compile-time Expression Optimization: Optimize integer and floating-point addition and multiplication.
- Arithmetic Evaluation: Automatically replace constant expressions with their evaluated results.
Installation
Add macro_optim to your Cargo.toml:
[]
= "1.0.0" # Replace with the appropriate version
Usage
To use the macro_optim attribute macro, annotate your code with #[macro_optim]. This macro will evaluate and replace constant expressions in the annotated item.
Example
use macro_optim;
In the example above, the expression 2 + 3 * 4 will be evaluated to 14 at compile time.
Limitations
- Currently supports only addition and multiplication.
- Supports only integer and floating-point literals.
- Complex expressions or non-literal values are not optimized.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
License
This crate is licensed under the Apache 2.0 License. See the LICENSE file for more details.