Crates.io | recursive |
lib.rs | recursive |
version | 0.1.1 |
source | src |
created_at | 2024-03-28 19:43:08.389101 |
updated_at | 2024-04-08 11:10:23.978981 |
description | Easy recursion without stack overflows. |
homepage | |
repository | https://github.com/orlp/recursive |
max_upload_size | |
id | 1189296 |
size | 8,083 |
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.
recursive
is licensed under the MIT license.