Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes for bevy_utils in no_std #15463

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,33 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
default = ["std"]
std = ["alloc", "tracing/std", "ahash/std"]
alloc = []
default = ["std", "serde"]
std = [
"alloc",
"tracing/std",
"ahash/std",
"dep:thread_local",
"ahash/runtime-rng",
]
alloc = ["hashbrown/default"]
detailed_trace = []
serde = ["hashbrown/serde"]

[dependencies]
ahash = { version = "0.8.7", default-features = false, features = [
"runtime-rng",
"compile-time-rng",
] }
tracing = { version = "0.1", default-features = false }
web-time = { version = "1.1" }
hashbrown = { version = "0.14.2", features = ["serde"] }
hashbrown = { version = "0.14.2", default-features = false }
bevy_utils_proc_macros = { version = "0.15.0-dev", path = "macros" }
thread_local = "1.0"
thread_local = { version = "1.0", optional = true }

[dev-dependencies]
static_assertions = "1.1.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2.0", features = ["js"] }
web-time = { version = "1.1" }

[lints]
workspace = true
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ mod default;
mod object_safe;
pub use object_safe::assert_object_safe;
mod once;
#[cfg(feature = "std")]
mod parallel_queue;
mod time;

pub use ahash::{AHasher, RandomState};
pub use bevy_utils_proc_macros::*;
pub use default::default;
pub use hashbrown;
#[cfg(feature = "std")]
pub use parallel_queue::*;
pub use time::*;
pub use tracing;
pub use web_time::{Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError};

#[cfg(feature = "alloc")]
use alloc::boxed::Box;
Expand Down
11 changes: 11 additions & 0 deletions crates/bevy_utils/src/time.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#[cfg(target_arch = "wasm32")]
pub use web_time::{Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError};

#[cfg(all(not(target_arch = "wasm32"), feature = "std"))]
pub use {
core::time::{Duration, TryFromFloatSecsError},
std::time::{Instant, SystemTime, SystemTimeError},
};

#[cfg(all(not(target_arch = "wasm32"), not(feature = "std")))]
pub use core::time::{Duration, TryFromFloatSecsError};