recursive

Crates.iorecursive
lib.rsrecursive
version0.1.1
sourcesrc
created_at2024-03-28 19:43:08.389101
updated_at2024-04-08 11:10:23.978981
descriptionEasy recursion without stack overflows.
homepage
repositoryhttps://github.com/orlp/recursive
max_upload_size
id1189296
size8,083
Orson Peters (orlp)

documentation

README

Recursive

With recursive you can easily make (indirectly) recursive functions without worrying about stack overflows by marking them as #[recursive]:

use recursive::recursive;

#[recursive]
fn sum(nums: &[u64]) -> u64 {
    if let Some((head, tail)) = nums.split_first() {
        head + sum(tail)
    } else {
        0
    }
}

Functions marked with #[recursive] will automatically grow the stack size if it is too small when called. See the crate docs for details.

License

recursive is licensed under the MIT license.

Commit count: 4

cargo fmt