rune/
alloc.rs

1//! # The Rune core allocation and collections library
2//!
3//! This library provides smart pointers and collections for managing
4//! heap-allocated values.
5//!
6//! It is a fork of the [`alloc`] and [`hashbrown`] crates with the following
7//! additions:
8//! * All allocations are fallible, and subject to memory limits imposed by the
9//!   [`limit`] module.
10//! * All colllections can be used by dynamic types, which can fallibly
11//!   implement the trait they need. Such as [`Hash`] and [`Eq`] for [`HashMap`]
12//!   or [`Ord`] for [`BTreeMap`]. This is accomplished using alternative
13//!   functions which receive fallible closures and contexts, such as
14//!   [`BTreeMap::get_mut_with`].
15//!
16//! [`alloc`]: https://doc.rust-lang.org/stable/alloc/
17//! [`hashbrown`]: https://docs.rs/hashbrown
18//!
19//! ## Boxed values
20//!
21//! The [`Box`] type is a smart pointer type. There can only be one owner of a
22//! [`Box`], and the owner can decide to mutate the contents, which live on the
23//! heap.
24//!
25//! This type can be sent among threads efficiently as the size of a `Box` value
26//! is the same as that of a pointer. Tree-like data structures are often built
27//! with boxes because each node often has only one owner, the parent.
28//!
29//! ## Collections
30//!
31//! Implementations of the most common general purpose data structures are
32//! defined in this library. They are re-exported through the
33//! [standard collections library](../std/collections/index.html).
34//!
35//! ## Heap interfaces
36//!
37//! The [`alloc`] module defines the low-level interface to the default global
38//! allocator. It is not compatible with the libc allocator API.
39//!
40//! [`Box`]: boxed
41//! [`Cell`]: core::cell
42//! [`RefCell`]: core::cell
43
44#[doc(inline)]
45pub use rune_alloc::*;