1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! # preprocessor
//!
//! Compile-time computation macros for Rust. Analyzes code for computable
//! sub-expressions and evaluates them at compile time, so the final binary
//! contains only the results.
//!
//! ## Macros
//!
//! | Macro | Scope | Description |
//! |---|---|---|
//! | `#[preprocessor::optimize]` | Function | Optimizes all evaluable expressions in a function body |
//! | `preprocessor::op!(...)` | Expression | Evaluates a single expression at compile time |
//!
//! ## Features
//!
//! | Feature | Description |
//! |---|---|
//! | `disabled` | Disables all compile-time optimization; macros become transparent passthrough |
//!
//! ## Example
//!
//! ```rust
//! use preprocessor::op;
//!
//! // Compile-time evaluation
//! let result = op!(1 + 2 * 3); // → 7
//!
//! // With free variables — compile error
//! // let x = 5;
//! // let y = op!(x + 1); // ERROR: cannot evaluate at compile time
//! ```
//!
//! ```rust,ignore
//! use preprocessor::optimize;
//!
//! #[optimize]
//! fn compute() -> i32 {
//! let a = 1 + 2; // → 3
//! let b = 4 * 5; // → 20
//! a + b
//! }
//! ```
pub use ;
/// When `disabled` feature is enabled, `op!` becomes transparent passthrough.
/// When `disabled` feature is enabled, `#[optimize]` becomes a no-op passthrough.
/// Uses a declarative macro wrapper that re-emits the function unchanged.
pub use optimize;