r_efi_alloc/
lib.rs

1//! UEFI Memory Allocator Integration
2//!
3//! This crate integrates the memory allocators of the rust standard library
4//! with the memory allocators provided by UEFI systems. The `raw` module
5//! implements the underlying unsafe allocator to interact with UEFI memory
6//! allocations from within rust. The `global` module implements the stable
7//! `GlobalAlloc` interface of the rust standard library, thus providing
8//! UEFI memory allocators to the rust standard library. Lastly, `alloc`
9//! implements the unstable `core::alloc::Allocator` trait which likely
10//! will take the role of the main rust memory allocators in the future.
11
12// The `core::alloc::Allocator` trait is still unstable and hidden behind the
13// `allocator_api` feature. Make sure to enable it, so we can implement this
14// trait. The `alloc_layout_extra` feature provides additional extensions to
15// the stable `Layout` object (in particular `dangling()` for ZSTs).
16#![cfg_attr(
17    feature = "allocator_api",
18    feature(alloc_layout_extra, allocator_api)
19)]
20
21// We need no features of std, so mark the crate as `no_std` (more importantly,
22// `std` might not even be available on UEFI systems). However, pull in `std`
23// during tests, so we can run them on the host.
24#![cfg_attr(not(test), no_std)]
25
26pub mod alloc;
27pub mod global;
28pub mod raw;