Skip to content

Commit 321ea12

Browse files
committed
zephyr: alloc: Add some documentation to the allocator
Write docs for the global allocator. This will also trigger bringing in the documentation for the module, which explains how to use the allocator. Signed-off-by: David Brown <[email protected]>
1 parent f66ae03 commit 321ea12

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

zephyr/src/alloc_impl.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ extern "C" {
6262
fn free(ptr: *mut u8);
6363
}
6464

65+
/// An allocator that uses Zephyr's allocation primitives.
66+
///
67+
/// This is exported for documentation purposes, this module does contain an instance of the
68+
/// allocator as well.
6569
pub struct ZephyrAllocator;
6670

6771
unsafe impl GlobalAlloc for ZephyrAllocator {
@@ -83,5 +87,6 @@ unsafe impl GlobalAlloc for ZephyrAllocator {
8387
}
8488
}
8589

90+
/// The global allocator built around the Zephyr malloc/free.
8691
#[global_allocator]
87-
static ZEPHYR_ALLOCATOR: ZephyrAllocator = ZephyrAllocator;
92+
pub static ZEPHYR_ALLOCATOR: ZephyrAllocator = ZephyrAllocator;

0 commit comments

Comments
 (0)