#cell #store #dungeon #dynamic #value #memory #unsized

no-std dungeon-cell

Store (almost) any value as one type without dynamic memory

4 releases

0.1.0 Jul 6, 2023
0.0.3 Feb 15, 2023
0.0.2 Feb 3, 2023
0.0.1 Jan 8, 2023

#202 in Memory management

Download history 4/week @ 2024-02-18 4/week @ 2024-02-25 85/week @ 2024-03-31

85 downloads per month



Version Maintenance Crates.io docs.rs Crates.io


Cell and Cell-like types that can store any type without dynamic memory.

Currently only the DungeonCore primitive is implemented (unsized, cell, stack vec, ... are in progress).

use dungeon_cell::{DungeonCore, layout_for};

// a default DungeonCore can store any 'static type that fits in the layout
let mut core = DungeonCore::<layout_for!(String)>::default();

// we can store a i32 and get it back
assert_eq!(core.take(), Some(1234i32));

// we can store a f64 and get it back
assert_eq!(core.take(), Some(1.234f64));

// lets get adventurous and store a String
core.store(String::from("hello world"));
assert_eq!(core.take(), Some(String::from("hello world")));

// we can't take a type the core isn't storing
assert_eq!(core.take(), None::<f32>);

// we can borrow both unique and shared
*core.borrow_mut::<i32>().unwrap() += 10;
assert_eq!(core.borrow(), Some(&1244i32));


  • "alloc" - Enable support for alloc types.
  • "std" - Enable support for std types. Also enables "alloc".
  • "unsize" - Enable use of the nightly feature unsize. Requires a nightly compiler.
  • "many_arg_fn" - Enable implementations for functions with 11-30 arguments.

No-std Support

This crate is #![no_std] by default, it can be used anywhere Rust can.

Minimum Supported Rust Version

Requires Rust 1.64.0.

This crate follows the "Latest stable Rust" policy. The listed MSRV won't be changed unless needed. However, updating the MSRV anywhere up to the latest stable at time of release is allowed.


Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in dungeon-cell by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.