15
15
//! The `proto` module contains the standard UEFI protocols, which are normally provided
16
16
//! by the various UEFI drivers and firmware layers.
17
17
//!
18
+ //! ## Optional Crate Features:
19
+ //! - `alloc`: Enables functionality requiring the `alloc` crate from the Rust standard library.
20
+ //! - For example, this allows many convenient `uefi-rs` functions to operate on heap data (`Box`).
21
+ //! - It is up to the user to provide a `#[global allocator]`.
22
+ //! - `global_allocator`: implements a `#[global allocator]` using UEFI functions.
23
+ //! - This allows you to use all abstractions from the `alloc` crate from the Rust standard library
24
+ //! during runtime. Hence, `Vec`, `Box`, etc. will be able to allocate memory.
25
+ //! **This is optional**, so you can provide a custom `#[global allocator]` as well.
26
+ //! - There's no guarantee of the efficiency of UEFI's allocator.
27
+ //! - `logger`: logging implementation for the standard [`log`] crate.
28
+ //! - Prints output to UEFI console.
29
+ //! - No buffering is done: this is not a high-performance logger.
30
+ //!
18
31
//! ## Adapting to local conditions
19
32
//!
20
33
//! Unlike system tables, which are present on *all* UEFI implementations,
27
40
#![ feature( maybe_uninit_slice) ]
28
41
#![ feature( negative_impls) ]
29
42
#![ feature( ptr_metadata) ]
30
- #![ cfg_attr( feature = "exts " , feature( vec_into_raw_parts) ) ]
43
+ #![ cfg_attr( feature = "alloc " , feature( vec_into_raw_parts) ) ]
31
44
#![ cfg_attr( docsrs, feature( doc_auto_cfg) ) ]
32
45
#![ no_std]
33
46
// Enable some additional warnings and lints.
34
47
#![ warn( clippy:: ptr_as_ptr, missing_docs, unused) ]
35
48
#![ deny( clippy:: all) ]
36
49
37
- // `uefi-exts` requires access to memory allocation APIs.
38
- #[ cfg( feature = "exts" ) ]
39
- extern crate alloc as alloc_api;
50
+ // Enable once we use vec![] or similar
51
+ // #[cfg_attr(feature = "alloc", macro_use)]
52
+ #[ cfg( feature = "alloc" ) ]
53
+ extern crate alloc;
40
54
41
55
// allow referring to self as ::uefi for macros to work universally (from this crate and from others)
42
56
// see https://github.com/rust-lang/rust/issues/54647
43
57
extern crate self as uefi;
44
58
45
59
#[ macro_use]
46
60
pub mod data_types;
47
- #[ cfg( feature = "exts " ) ]
61
+ #[ cfg( feature = "alloc " ) ]
48
62
pub use self :: data_types:: CString16 ;
49
63
pub use self :: data_types:: { unsafe_guid, Identify } ;
50
64
pub use self :: data_types:: { CStr16 , CStr8 , Char16 , Char8 , Event , Guid , Handle } ;
@@ -59,8 +73,8 @@ pub mod proto;
59
73
60
74
pub mod prelude;
61
75
62
- #[ cfg( feature = "alloc " ) ]
63
- pub mod alloc ;
76
+ #[ cfg( feature = "global_allocator " ) ]
77
+ pub mod global_allocator ;
64
78
65
79
#[ cfg( feature = "logger" ) ]
66
80
pub mod logger;
0 commit comments