Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_platform/src/lib.rs
9328 views
1
#![cfg_attr(docsrs, feature(doc_cfg))]
2
#![doc(
3
html_logo_url = "https://bevy.org/assets/icon.png",
4
html_favicon_url = "https://bevy.org/assets/icon.png"
5
)]
6
#![no_std]
7
8
//! Platform compatibility support for first-party [Bevy] engine crates.
9
//!
10
//! [Bevy]: https://bevy.org/
11
12
cfg::std! {
13
extern crate std;
14
}
15
16
cfg::alloc! {
17
extern crate alloc;
18
19
pub mod collections;
20
}
21
22
pub mod cell;
23
pub mod cfg;
24
pub mod future;
25
pub mod hash;
26
pub mod sync;
27
pub mod thread;
28
pub mod time;
29
30
/// Frequently used items which would typically be included in most contexts.
31
///
32
/// When adding `no_std` support to a crate for the first time, often there's a substantial refactor
33
/// required due to the change in implicit prelude from `std::prelude` to `core::prelude`.
34
/// This unfortunately leaves out many items from `alloc`, even if the crate unconditionally
35
/// includes that crate.
36
///
37
/// This prelude aims to ease the transition by re-exporting items from `alloc` which would
38
/// otherwise be included in the `std` implicit prelude.
39
pub mod prelude {
40
crate::cfg::alloc! {
41
pub use alloc::{
42
borrow::ToOwned, boxed::Box, format, string::String, string::ToString, vec, vec::Vec,
43
};
44
}
45
46
// Items from `std::prelude` that are missing in this module:
47
// * dbg
48
// * eprint
49
// * eprintln
50
// * is_x86_feature_detected
51
// * print
52
// * println
53
// * thread_local
54
}
55
56
/// Re-exports of crates that are useful across Bevy.
57
/// Not intended for external crates to use.
58
#[doc(hidden)]
59
pub mod exports {
60
crate::cfg::web! {
61
pub use js_sys;
62
pub use wasm_bindgen;
63
pub use wasm_bindgen_futures;
64
}
65
}
66
67