
# Objective - Fixes #17506 - Fixes #16258 ## Solution - Added a new folder of examples, `no_std`, similar to the `mobile` folder. - Added a single example, `no_std_library`, which demonstrates how to make a `no_std` compatible Bevy library. - Added a new CI task, `check-compiles-no-std-examples`, which checks that `no_std` examples compile on `no_std` targets. - Added `bevy_platform_support::prelude` to `bevy::prelude`. ## Testing - CI --- ## Notes - I've structured the folders here to permit further `no_std` examples (e.g., GameBoy Games, ESP32 firmware, etc.), but I am starting with the simplest and least controversial example. - I've tried to be as clear as possible with the documentation for this example, catering to an audience who may not have even heard of `no_std` before. --------- Co-authored-by: Greeble <166992735+greeble-dev@users.noreply.github.com>
19 lines
1.4 KiB
Markdown
19 lines
1.4 KiB
Markdown
# `no_std` Examples
|
|
|
|
This folder contains examples for how to work with `no_std` targets and Bevy.
|
|
Refer to each example individually for details around how it works and what features you may need to enable/disable to allow a particular target to work.
|
|
|
|
## What is `no_std`?
|
|
|
|
`no_std` is a Rust term for software which doesn't rely on the standard library, [`std`](https://doc.rust-lang.org/stable/std/).
|
|
The typical use for `no_std` is in embedded software, where the device simply doesn't support the standard library.
|
|
For example, a [Raspberry Pi Pico](https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html) has no operating system to support threads or filesystem operations.
|
|
|
|
For these platforms, Rust has a more fundamental alternative to `std`, [`core`](https://doc.rust-lang.org/stable/core/).
|
|
A large portion of Rust's `std` actually just re-exports items from `core`, such as iterators, `Result`, and `Option`.
|
|
|
|
In addition, `std` also re-exports from another crate, [`alloc`](https://doc.rust-lang.org/stable/alloc/).
|
|
This crate is similar to `core` in that it's generally available on all platforms.
|
|
Where it differs is that its inclusion requires access to a [global allocator](https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html).
|
|
Currently, Bevy relies heavily on allocation, so we consider `alloc` to be just as available, since without it, Bevy will not compile.
|