File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: MIT OR Apache-2.0
22
3- //! This module implements Rust's global allocator interface using UEFI's memory allocation functions .
3+ //! This module exports [`Allocator`] .
44//!
5- //! If the `global_allocator` feature is enabled, the [`Allocator`] will be used
6- //! as the global Rust allocator .
5+ //! The allocator can be used as global Rust allocator using the
6+ //! `global_allocator` crate feature. See [`helpers`] for more info .
77//!
8- //! This allocator can only be used while boot services are active. If boot
9- //! services are not active, `alloc` will return a null pointer, and `dealloc`
10- //! will panic.
8+ //! [`helpers`]: uefi::helpers
119
1210use crate :: boot;
1311use crate :: mem:: memory_map:: MemoryType ;
@@ -42,9 +40,13 @@ fn get_memory_type() -> MemoryType {
4240 }
4341}
4442
45- /// Allocator which uses the UEFI pool allocation functions .
43+ /// Allocator using UEFI boot services .
4644///
47- /// Only valid for as long as the UEFI boot services are available.
45+ /// This type implements [`GlobalAlloc`] and can be marked with the
46+ /// `#[global_allocator]` attribute to be used as global Rust allocator.
47+ ///
48+ /// Note that if boot services are not active (anymore), [`Allocator::alloc`]
49+ /// will return a null pointer and [`Allocator::dealloc`] will panic.
4850#[ derive( Debug ) ]
4951pub struct Allocator ;
5052
You can’t perform that action at this time.
0 commit comments