Skip to content

Commit

Permalink
reexport instant::{Duration, Instant} from bevy_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-its committed Nov 21, 2020
1 parent 211e009 commit ae2d7e2
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 22 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ anyhow = "1.0"
rand = "0.7.3"
ron = "0.6"
serde = {version = "1", features = ["derive"]}
instant = "0.1"

[[example]]
name = "hello_world"
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ bevy_utils = { path = "../bevy_utils", version = "0.3.0" }

# other
serde = { version = "1.0", features = ["derive"] }
instant = { version = "0.1", features = ["wasm-bindgen"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/schedule_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
event::{EventReader, Events},
plugin::Plugin,
};
use instant::{Duration, Instant};
use bevy_utils::{Duration, Instant};

#[cfg(target_arch = "wasm32")]
use std::{cell::RefCell, rc::Rc};
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" }
bevy_math = { path = "../bevy_math", version = "0.3.0" }
bevy_utils = { path = "../bevy_utils", version = "0.3.0" }
bevy_tasks = { path = "../bevy_tasks", version = "0.3.0" }
instant = { version = "0.1", features = ["wasm-bindgen"] }
2 changes: 1 addition & 1 deletion crates/bevy_core/src/time/time.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bevy_ecs::ResMut;
use instant::{Duration, Instant};
use bevy_utils::{Duration, Instant};

/// Tracks elapsed time since the last update and since the App has started
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core/src/time/timer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::time::Time;
use bevy_ecs::prelude::*;
use bevy_property::Properties;
use instant::Duration;
use bevy_utils::Duration;

/// Tracks elapsed time. Enters the finished state once `duration` is reached.
///
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ bevy_utils = { path = "../bevy_utils", version = "0.3.0" }
# other
uuid = { version = "0.8", features = ["v4", "serde"] }
parking_lot = "0.11.0"
instant = { version = "0.1", features = ["wasm-bindgen"] }
3 changes: 1 addition & 2 deletions crates/bevy_diagnostic/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bevy_utils::HashMap;
use instant::{Duration, Instant};
use bevy_utils::{Duration, HashMap, Instant};
use std::collections::VecDeque;
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_diagnostic/src/print_diagnostics_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::{Diagnostic, DiagnosticId, Diagnostics};
use bevy_app::prelude::*;
use bevy_core::{Time, Timer};
use bevy_ecs::{Res, ResMut};
use instant::Duration;
use bevy_utils::Duration;

/// An App Plugin that prints diagnostics to the console
pub struct PrintDiagnosticsPlugin {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ futures-lite = "1.4.0"
event-listener = "2.4.0"
async-executor = "1.3.0"
async-channel = "1.4.2"
instant = "0.1"
instant = { version = "0.1", features = ["wasm-bindgen"] }
num_cpus = "1"
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4"
2 changes: 1 addition & 1 deletion crates/bevy_tasks/src/countdown_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn countdown_event_ready() {
std::thread::spawn(move || futures_lite::future::block_on(countdown_event_clone.listen()));

// Pause to give the new thread time to start blocking (ugly hack)
std::thread::sleep(instant::Duration::from_millis(100));
std::thread::sleep(bevy_utils::Duration::from_millis(100));

countdown_event.decrement();
handle.join().unwrap();
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ keywords = ["bevy"]
[dependencies]
ahash = "0.5.3"
tracing = {version = "0.1", features = ["release_max_level_info"]}
instant = { version = "0.1", features = ["wasm-bindgen"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = {version = "0.2.0", features = ["js"]}
4 changes: 2 additions & 2 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use ahash::AHasher;
use ahash::RandomState;
pub use instant::{Duration, Instant};
use std::{future::Future, pin::Pin};

pub use ahash::AHasher;
pub use tracing;

#[cfg(not(target_arch = "wasm32"))]
Expand Down
3 changes: 1 addition & 2 deletions examples/app/headless.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bevy::{app::ScheduleRunnerSettings, prelude::*};
use instant::Duration;
use bevy::{app::ScheduleRunnerSettings, prelude::*, utils::Duration};

// This example only enables a minimal set of plugins required for bevy to run.
// You can also completely remove rendering / windowing Plugin code from bevy
Expand Down
3 changes: 1 addition & 2 deletions examples/app/plugin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bevy::prelude::*;
use instant::Duration;
use bevy::{prelude::*, utils::Duration};

/// Plugins are the foundation of Bevy. They are scoped sets of components, resources, and systems
/// that provide a specific piece of functionality (generally the smaller the scope, the better).
Expand Down
2 changes: 1 addition & 1 deletion examples/ecs/ecs_guide.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use bevy::{
app::{AppExit, ScheduleRunnerPlugin, ScheduleRunnerSettings},
prelude::*,
utils::Duration,
};
use instant::Duration;
use rand::random;

/// This is a guided introduction to Bevy's "Entity Component System" (ECS)
Expand Down
4 changes: 2 additions & 2 deletions examples/scene/scene.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{prelude::*, type_registry::TypeRegistry};
use bevy::{prelude::*, type_registry::TypeRegistry, utils::Duration};

/// This example illustrates loading and saving scenes from files
fn main() {
Expand Down Expand Up @@ -37,7 +37,7 @@ struct ComponentA {
struct ComponentB {
pub value: String,
#[property(ignore)]
pub time_since_startup: instant::Duration,
pub time_since_startup: Duration,
}

impl FromResources for ComponentB {
Expand Down
2 changes: 1 addition & 1 deletion examples/wasm/headless_wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use bevy::{
app::{ScheduleRunnerPlugin, ScheduleRunnerSettings},
log::LogPlugin,
prelude::*,
utils::Duration,
};
use instant::Duration;

fn main() {
App::build()
Expand Down

0 comments on commit ae2d7e2

Please sign in to comment.