bevy_platform/lib.rs
1#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2#![doc(
3 html_logo_url = "https://bevyengine.org/assets/icon.png",
4 html_favicon_url = "https://bevyengine.org/assets/icon.png"
5)]
6#![no_std]
7
8//! Platform compatibility support for first-party [Bevy] engine crates.
9//!
10//! [Bevy]: https://bevyengine.org/
11
12#[cfg(feature = "std")]
13extern crate std;
14
15#[cfg(feature = "alloc")]
16extern crate alloc;
17
18pub mod hash;
19pub mod sync;
20pub mod thread;
21pub mod time;
22
23#[cfg(feature = "alloc")]
24pub mod collections;
25
26/// Frequently used items which would typically be included in most contexts.
27///
28/// When adding `no_std` support to a crate for the first time, often there's a substantial refactor
29/// required due to the change in implicit prelude from `std::prelude` to `core::prelude`.
30/// This unfortunately leaves out many items from `alloc`, even if the crate unconditionally
31/// includes that crate.
32///
33/// This prelude aims to ease the transition by re-exporting items from `alloc` which would
34/// otherwise be included in the `std` implicit prelude.
35pub mod prelude {
36 #[cfg(feature = "alloc")]
37 pub use alloc::{
38 borrow::ToOwned, boxed::Box, format, string::String, string::ToString, vec, vec::Vec,
39 };
40
41 // Items from `std::prelude` that are missing in this module:
42 // * dbg
43 // * eprint
44 // * eprintln
45 // * is_x86_feature_detected
46 // * print
47 // * println
48 // * thread_local
49}