daywalker
Write nightly-conditional code once. Run on both nightly and stable Rust.
roam!
Perfect for library authors - write once, let users choose between nightly features or stable compatibility.
How it works
- Use the function-like proc-macro:
roam! { ... }. - Inside the proc-macro, use the conditional operators ("bitemarks"):
++[...]: Emit code only whennightlyfeature is enabled--[...]: Emit code only whennightlyfeature is disabled
Features
- Zero-cost - Simple conditional inclusion, no runtime overhead
- Forward compatible - Easy migration when nightly features stabilize
- Lightweight - Single proc-macro, no dependencies
- Flexible - Works with any nightly-specific syntax or tokens
- Granular control - Conditionally include any code block or token
For Library Authors
Write nightly-optional code that work for everyone! First, expose the choice to your library users:
# Cargo.toml
[]
= "cool-lib"
= "1.0.0"
[]
= "1.0"
[]
= ["daywalker/nightly"]
Then, define and implement conditional code using the nightly syntax with prefix operators:
// src/lib.rs
roam!
For Library Users
Stable
If you want to run on stable rust, use the library like normal. First, add the dependency:
# Cargo.toml
[]
= "1.0"
Then use the dependency:
// src/main.rs
use Compute;
let value: u32 = 42u32.compute; // ✅ Runtime
That's it!
Nightly
On the other hand, if you want that sweet nightly functionality and are willing
to accept the requirement to compile only on nightly, then just use the
nightly feature:
# Cargo.toml
[]
= { = "1.0", = ["nightly"] }
Look, you get nightly features!
// src/main.rs
use Compute;
const VALUE: u32 = 42u32.compute; // ✅ Compile-time