craft_eraser/
lib.rs

1//! Implementations of type-erasure tools, which store fully non-generic data on the heap.
2//!
3//! Current features include:
4//!
5//! # Erased Boxes
6//!
7//! These are useful for cases where `Box<dyn Any>` doesn't fulfill your needs, including
8//! non-`'static` data or wanting to store the data in one pointer even when unsized. As
9//! a trade-off, there is no safe way to retrieve the data, as the user must already know the
10//! type and lifetimes involved and verify them without the help of the compiler.
11//!
12//! # Erased Pointer
13//!
14//! The unowned equivalent to an erased box. Basically just a pointer-meta pair, that ensures
15//! the meta is handled correctly on destruction.
16
17#![feature(ptr_metadata)]
18#![warn(
19    missing_docs,
20    elided_lifetimes_in_paths,
21    explicit_outlives_requirements,
22    missing_abi,
23    noop_method_call,
24    semicolon_in_expressions_from_macros,
25    unused_import_braces,
26    unused_lifetimes,
27    clippy::cargo,
28    clippy::missing_panics_doc,
29    clippy::doc_markdown,
30    clippy::ptr_as_ptr,
31    clippy::cloned_instead_of_copied,
32    clippy::unreadable_literal
33)]
34#![no_std]
35
36extern crate alloc;
37
38pub mod ebox;
39pub mod eptr;
40pub mod eref;
41pub mod thin_ebox;
42
43pub use ebox::ErasedBox;
44pub use eptr::{ErasedNonNull, ErasedPtr};
45pub use eref::{ErasedMut, ErasedRef};
46pub use thin_ebox::ThinErasedBox;