File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1010 - [ Using Protocols] ( how_to/protocols.md )
1111 - [ Drawing to the Screen] ( how_to/drawing.md )
1212 - [ Building drivers] ( how_to/building_drivers.md )
13+ - [ Combining Rust ` std ` with ` uefi ` ] ( how_to/rust-std.md )
1314- [ Concepts] ( concepts/introduction.md )
1415 - [ Boot Stages] ( concepts/boot_stages.md )
1516 - [ Tables] ( concepts/tables.md )
Original file line number Diff line number Diff line change 1+ # Combining Rust ` std ` with ` uefi `
2+
3+ ## TL;DR
4+
5+ In Mid-2024, we recommend to stick to our normal guide. Use this document as
6+ guide and outlook for the future of UEFI and Rust.
7+
8+ ## About
9+
10+ Programs created with the ` uefi ` crate are typically created with ` #![no_std] `
11+ and ` #![no_main] ` . A ` #![no_std] ` crate can use the ` core ` and ` alloc ` parts of
12+ Rust's standard library, but not ` std ` . A ` #![no_std] ` executable does not use
13+ the standard main entry point, and must define its own entry point; ` uefi `
14+ provides the ` #[entry] ` macro for this purpose.
15+
16+ Rust has added partial support for building UEFI executables without
17+ ` #![no_std] ` and ` #![no_main] ` , thus, the standard way. Some functionality
18+ requires a nightly toolchain, they are gated by the ` uefi_std ` feature (Rust
19+ language feature, not ` uefi ` crate feature). Follow the
20+ [ tracking issue] ( https://github.com/rust-lang/rust/issues/100499 ) for details.
21+
22+ ## Code Example
23+
24+ Please refer to [ ` <repo>/uefi-std-example ` ] ( /uefi-std-example/README.md ) to
25+ see a specific example. The relevant ` main.rs ` looks as follows:
26+
27+ ``` rust
28+ {{#include .. / .. / .. / uefi - std - example / src / main . rs}}
29+ ```
You can’t perform that action at this time.
0 commit comments