bevy/crates/bevy_utils/src/time.rs
Zachary Harrold 53adcd7667
Minor fixes for bevy_utils in no_std (#15463)
# Objective

- Contributes to #15460

## Solution

- Made `web-time` a `wasm32`-only dependency.
- Moved time-related exports to its own module for clarity.
- Feature-gated allocator requirements for `hashbrown` behind `alloc`.
- Enabled compile-time RNG for `ahash` (runtime RNG will preferentially
used in `std` environments)
- Made `thread_local` optional by feature-gating the `Parallel` type.

## Testing

- Ran CI locally.
- `cargo build -p bevy_utils --target "x86_64-unknown-none"
--no-default-features`
2024-10-04 19:25:49 +00:00

12 lines
419 B
Rust

#[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};