rune

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§

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

Macros§

Structs§

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

Enums§

  • The error type for methods which allocate or reserve.

Functions§

  • Terminates the process in an abnormal fashion.

Type Aliases§

  • A Result aliased specialized towards an allocation Error.