Module alloc

Source
Expand description

§The Rune core allocation and collections library

This library provides smart pointers and collections for managing heap-allocated values.

It is a fork of the alloc and hashbrown crates with the following additions:

  • All allocations are fallible, and subject to memory limits imposed by the limit module.
  • All colllections can be used by dynamic types, which can fallibly implement the trait they need. Such as Hash and Eq for HashMap or Ord for BTreeMap. This is accomplished using alternative functions which receive fallible closures and contexts, such as BTreeMap::get_mut_with.

§Boxed values

The Box type is a smart pointer type. There can only be one owner of a Box, and the owner can decide to mutate the contents, which live on the heap.

This type can be sent among threads efficiently as the size of a Box value is the same as that of a pointer. Tree-like data structures are often built with boxes because each node often has only one owner, the parent.

§Collections

Implementations of the most common general purpose data structures are defined in this library. They are re-exported through the standard collections library.

§Heap interfaces

The alloc module defines the low-level interface to the default global allocator. It is not compatible with the libc allocator API.

Modules§

alloc
Allocated types.
borrow
A module for working with borrowed data.
boxed
The Box<T> type for heap allocation.
btree_map
An ordered map based on a B-Tree.
btree_set
An ordered set based on a B-Tree.
callable
A trait used for types which can be called.
clone
The TryClone trait for types that cannot be ‘implicitly copied’.
error
Error types used by rune alloc.
fmt
Built-in formatting utilities.
hashbrown
This is a fork of the hashbrown crate.
iter
Composable external iteration.
limit
Memory limits for Rune.
path
Cross-platform path manipulation.
prelude
Prelude for common traits used in combination with this crate which matches the behavior of the std prelude.
str
Utilities for the str primitive type.
string
A UTF-8–encoded, growable string.
vec
A contiguous growable array type with heap-allocated contents, written Vec<T>.
vec_deque
A double-ended queue (deque) implemented with a growable ring buffer.

Macros§

try_format
Creates a String using interpolation of runtime expressions.
try_vec

Structs§

BTreeMap
An ordered map based on a B-Tree.
BTreeSet
An ordered set based on a B-Tree.
Box
A pointer type that uniquely owns a heap allocation of type T.
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HashSet
A hash set implemented as a HashMap where the value is ().
String
A UTF-8–encoded, growable string.
Vec
A contiguous growable array type, written as Vec<T>, short for ‘vector’.
VecDeque
A double-ended queue implemented with a growable ring buffer.

Enums§

Error
The error type for methods which allocate or reserve.

Functions§

abort
Terminates the process in an abnormal fashion.

Type Aliases§

Result
A Result aliased specialized towards an allocation Error.