1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#![cfg_attr(not(any(test, feature = "std")), no_std)]
#![cfg_attr(has_feature_const_type_name, feature(const_type_name))]
// This crate **doesn't** use generic_const_exprs for correctness.
#![cfg_attr(has_feature_generic_const_exprs, allow(incomplete_features))]
#![cfg_attr(has_feature_generic_const_exprs, feature(generic_const_exprs))]
//! # Dungeon Cell
//!
//! Cell and Cell-like types that can store any static type without dynamic memory.
//!
//! Currently only the core primitive is implemented (unsized, cell, stack vec, ... are in progress).
//!
//! ## Example
//! ```
//! use dungeon_cell::{DungeonCore, layout_for};
//!
//! let mut c: DungeonCore<layout_for!(i32, f64)> = DungeonCore::new();
//!
//! // we can store a i32 and get it back
//! c.store(1234);
//! assert_eq!(c.take::<i32>(), Some(1234));
//!
//! // we can store a f64 and get it back
//! c.store(1.234);
//! assert_eq!(c.take::<f64>(), Some(1.234));
//!
//! // we can't take a type the core isn't storing
//! c.store(1234);
//! assert_eq!(c.take::<f64>(), None);
//!
//! // we can borrow both unique and shared
//! c.store(1234);
//! *c.borrow_mut::<i32>().unwrap() += 10;
//! assert_eq!(c.borrow::<i32>(), Some(&1244));
//! ```
#[cfg(all(feature = "alloc", not(feature = "std")))]
extern crate alloc;
#[cfg(all(feature = "alloc", feature = "std"))]
use std::alloc;
mod layout;
pub mod valid_generic_markers;
// mod trait_markers;
pub mod vtable;
mod align;
mod core;
// mod unsize;
// mod cell;
// mod any;
// mod cell;
pub use self::core::*;
pub use align::*;
pub use layout::*;
// pub use unsize::*;
// pub use cell::*;
// pub use any::*;