Easy recursion in Rust, without stack overflows.

Overview

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.

You might also like...
a Rust library implementing safe, lightweight context switches, without relying on kernel services

libfringe libfringe is a library implementing safe, lightweight context switches, without relying on kernel services. It can be used in hosted environ

A Python package written in Rust for email verification without sending any emails.

PyRustify PyRustify is a Python package written in Rust that verifies the email addresses. Features Feature Description Syntax validation Checks if th

Unborrowed Rust Compiler (rustc without a borrowchecker)

ubrustc: Unborrowed rustc This is rustc with the borrow checker disabled. I wrote it in like, 30 minutes because this tweet made me laugh. Example //

Maniplate `&'static str` (e.g., `concat!`, `format!`) in Rust without pain!

static_str_ops The static_str_ops crate solves a longstanding issue about how to perform non-const string operations, e.g., format!(), concat!(), etc.

💫 This program allows you to do requests in Rust without reqwest !

Zapros 💫 This program allows you to do requests in Rust without reqwest ! Usage : Get use crate::http_client::HttpClient; use crate::http_client::Htt

Padding/aligning values without heap allocation

zero-copy-pads Padding/aligning values without heap allocation. Cargo Features std (default feature): Disable #![no_std]. Enable features that require

fail CI on rustc and clippy warnings without breakage

A crate + github actions template that fails CI on rustc and clippy warnings without breakage.

🕺 Run React code snippets/components from your command-line without config

Run React code snippets/components from your command-line without config.

A simple program that provides DBus interface to control display temperature and brightness under wayland without flickering

wl-gammarelay-rs Like wl-gammarelay, but written in rust, runs on a single thread, has three times less SLOC and uses DBus (for simplicity). Dbus inte

Comments
Owner
Orson Peters
Orson Peters
plonky2 recursion framework handling different circuits in unified way.

generic_recursion Version: 0.1.0 generic_recursion is a crate that allows to easily aggregate an unlimited amount of plonky2 proofs, generated with a

null 6 Mar 4, 2024
Workflows make it easy to browse, search, execute and share commands (or a series of commands)--without needing to leave your terminal.

Workflows The repo for all public Workflows that appear within Warp and within commands.dev. To learn how to create local or repository workflows, see

Warp 369 Jan 2, 2023
Workflows make it easy to browse, search, execute and share commands (or a series of commands)--without needing to leave your terminal.

Workflows The repo for all public Workflows that appear within Warp and within commands.dev. To learn how to create local or repository workflows, see

Warp 227 Jun 1, 2022
🦀🔨 DevBcn Workshop - Full Stack Rust - Actix - Postgres - Shuttle - Dioxus

Building a Movie Collection Manager - Full Stack Workshop with Rust, Actix, SQLx, Dioxus, and Shuttle Welcome to the this workshop! In this hands-on w

BcnRust 57 Jul 12, 2023
A Nix template for full-stack web apps in Rust using Leptos

leptos-fullstack A Nix template for full-stack web apps in Rust using Leptos. Tech used: Leptos full-stack framework server functions ssr + hydration

Sridhar Ratnakumar 6 Aug 4, 2023
SquidVM is a VM made in Rust implementing a Stack-based machine.

What is SquidVM? _____ _ ___ ____ __ / ____| (_) | \ \ / / \/ | | (___ __ _ _ _ _ __| |\ \ / /| \ /

Fragmenta 4 Dec 17, 2023
"Better" tab and stack navigation for Sway WM.

sway_bfocus "Better" tab and stack navigation for Sway WM. Proof of concept. This program lets you create one set of keybinds exclusively for cycling

null 42 Oct 23, 2022
Another approach to thread stack spoofing.

Description This Twitter thread inspired the creation of this tool. Unwinder is a PoC of how to parse PE's UNWIND_INFO structs in order to achieve "pr

Kurosh Dabbagh Escalante 132 Jan 6, 2023
Dragonfly, POC full-stack web app DSL

Dragonfly Dragonfly is a toy DSL that explores ways to describe the structure of full-stack web applications. You should not use it in production. For

Bas Dirks 9 Mar 15, 2023
A mini paste bin and url shortener written in rust without databases.

pb Build $ cargo build --release Environment Variables PB_DATA: /some/path (Default: ./pb_data) PB_SITE: Url of your site. (Default: http://localhost:

Edward P 5 Jul 26, 2022