decurse/
lib.rs

1//! See the [README](https://github.com/wishawa/decurse) for an overview of this crate and how to use.
2//!
3//! The only things here are the two macros.
4//! To use, put them above your recursive function.
5//!
6//! ```text
7//! #[decurse::decurse]
8//! fn some_function(...) -> ...
9//! ```
10//!
11//! ```text
12//! #[decurse::decurse_unsound]
13//! fn some_function(...) -> ...
14//! ```
15//! Also make sure to read [the Limitations section in the README](https://github.com/wishawa/decurse#limitations).
16
17/// Private for use by the macro only.
18pub mod for_macro_only;
19
20/// Macro to make recursive functions run on the heap.
21///
22/// This is the version you should prefer.
23/// This does not use unsafe code and is thus **safe**.
24///
25/// However, it does **not** work on functions with lifetimed types (`&T`, `SomeStruct<'a>`, etc.) in the argument or return type.
26pub use for_macro_only::sound::decurse_sound as decurse;
27
28/// Macro to make recursive functions run on the heap.
29///
30/// Works on functions with lifetimed args/return, but might be unsound.
31/// This macro uses unsafe code in very dangerous ways.
32/// I am far from confident that it is safe, so I'm calling it unsound.
33/// However, I have yet to come up with an example to demonstrate unsoundness,
34/// so there is a small chance that this might actually be sound,
35/// so for brave souls, *try it out*!
36pub use for_macro_only::unsound::decurse_unsound;