Skip to content

Commit ffa9b1a

Browse files
uefi: Improve the feature list docstring section
Use paragraphs instead of bullets, add `panic-on-logger-errors`, and mention `uefi-services` can be used to initialize the allocator and logger.
1 parent 2036bed commit ffa9b1a

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

uefi/src/lib.rs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,28 @@
1515
//! The `proto` module contains the standard UEFI protocols, which are normally provided
1616
//! by the various UEFI drivers and firmware layers.
1717
//!
18-
//! ## Optional crate features:
18+
//! ## Optional crate features
1919
//!
20-
//! - `alloc`: Enables functionality requiring the `alloc` crate from the Rust standard library.
21-
//! - For example, this allows many convenient `uefi-rs` functions to operate on heap data (`Box`).
22-
//! - It is up to the user to provide a `#[global_allocator]`.
23-
//! - `global_allocator`: implements a `#[global_allocator]` using UEFI functions.
24-
//! - This allows you to use all abstractions from the `alloc` crate from the Rust standard library
25-
//! during runtime. Hence, `Vec`, `Box`, etc. will be able to allocate memory.
26-
//! **This is optional**, so you can provide a custom `#[global_allocator]` as well.
27-
//! - There's no guarantee of the efficiency of UEFI's allocator.
28-
//! - `logger`: logging implementation for the standard [`log`] crate.
29-
//! - Prints output to UEFI console.
30-
//! - No buffering is done: this is not a high-performance logger.
20+
//! - `alloc`: Enable functionality requiring the [`alloc`] crate from
21+
//! the Rust standard library. For example, methods that return a
22+
//! `Vec` rather than filling a statically-sized array. This requires
23+
//! a global allocator; you can use the `global_allocator` feature or
24+
//! provide your own.
25+
//! - `global_allocator`: Implement a [global allocator] using UEFI
26+
//! functions. This is a simple allocator that relies on the UEFI pool
27+
//! allocator. You can choose to provide your own allocator instead of
28+
//! using this feature, or no allocator at all if you don't need to
29+
//! dynamically allocate any memory.
30+
//! - `logger`: Logging implementation for the standard [`log`] crate
31+
//! that prints output to the UEFI console. No buffering is done; this
32+
//! is not a high-performance logger.
33+
//! - `panic-on-logger-errors` (enabled by default): Panic if a text
34+
//! output error occurs in the logger.
35+
//!
36+
//! The `global_allocator` and `logger` features require special
37+
//! handling to perform initialization and tear-down. The
38+
//! [`uefi-services`] crate provides an `init` method that takes care of
39+
//! this.
3140
//!
3241
//! ## Adapting to local conditions
3342
//!
@@ -36,6 +45,9 @@
3645
//!
3746
//! For example, a PC with no network card might not contain a network driver,
3847
//! therefore all the network protocols will be unavailable.
48+
//!
49+
//! [`GlobalAlloc`]: alloc::alloc::GlobalAlloc
50+
//! [`uefi-services`]: https://crates.io/crates/uefi-services
3951
4052
#![feature(abi_efiapi)]
4153
#![feature(maybe_uninit_slice)]

0 commit comments

Comments
 (0)