Crate storage_api

Source
Expand description

§Storage API

Latest Version Rust Documentation GitHub license

Note: This crate currently requires using nightly by default, unless you make default-features = false, this is so Box can support T: ?Sized

This is an implementation of the Storage API, a better version of the Allocator API, and data structures made for them including

  • Box
  • Vec
  • String

§How is it better than Allocator?

Storages have an associated Handle type so allocations dont need to be represented by a pointer, which allows Storages to allocate from a buffer they store inline

Instead of having Vec and ArrayVec as 2 seperate data structures they can be merged together, only using different Storages

Modules§

collections
The collections that use a Storage for their backing data
storages
The types that implement Storage

Structs§

Box
A type that owns a single T allocated in a Storage
Global
This represents the global allocator registered with the #[global_allocator] attribute
InlineStorage
Represents an inline storage with the size/alignment requirements of T, this Storage type being possible of the main reasons for the Storage API existing
SlotStorage
Represents a buffer of bytes that can be allocated from
StorageAllocError
The error returned when allocating using a Storage fails
String
A wrapper around Vec<u8, S> that is guarenteed to be valid UTF-8 so it can be referenced as a str
Vec
A collection for managing a list of elements

Traits§

MultipleStorage
A marker trait related to Storage that guarentees that multiple allocations can be made from a Storage without invalidating old ones
Storage
The trait for allocating memory in a storage
StorageHandle
The trait that all Storage::Handles must implement