alloca

Crates.ioalloca
lib.rsalloca
version0.4.0
sourcesrc
created_at2021-01-27 18:32:37.841408
updated_at2023-08-03 12:08:27.714601
descriptionMostly safe wrapper for alloca
homepage
repositoryhttps://github.com/playXE/alloca-rs
max_upload_size
id347417
size9,334
playX (playXE)

documentation

README

alloca-rs

Build Status Latest Version Documentation

Mostly safe no_std wrapper for alloca in Rust.

This crate uses Rust lifetime system to ensure that stack allocated memory will not be used after function return, but it does not make any guarantee about memory that is turned into raw pointer and stored somewhere else.

Example

fn main() {
    // allocate 128 bytes on the stack
    alloca::with_alloca(128, |memory| {
        // memory: &mut [MaybeUninit<u8>]
        assert_eq!(memory.len(), 128);
    });
}
Commit count: 48

cargo fmt