Skip to content

Commit

Permalink
refactor: remove once_cell dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Dec 13, 2023
1 parent f26a6ff commit be2ba23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/vitri-ent/vmc"
documentation = "https://docs.rs/vmc"
readme = "README.md"
edition = "2021"
keywords = [ "virtual-motion-capture", "osc" ]
keywords = [ "osc" ]
categories = [ "network-programming", "asynchronous" ]
authors = [
"Carson M. <[email protected]>"
Expand All @@ -25,7 +25,6 @@ serde = { version = "1.0", optional = true, features = [ "derive" ] }
tokio = { version = "1.30", features = [ "net" ] }
tokio-stream = "0.1"
thiserror = "1.0"
once_cell = "1.15"

[dev-dependencies]
tokio = { version = "1.30", features = [ "net", "macros", "rt-multi-thread" ] }
Expand Down
7 changes: 3 additions & 4 deletions src/message.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! Submodule for Virtual Motion Capture-specific messages.

use std::{str::FromStr, time::Instant};
use std::{str::FromStr, sync::OnceLock, time::Instant};

use nalgebra::{Quaternion, Scale3, UnitQuaternion, Vector3};
use once_cell::sync::Lazy;

use crate::{osc::OSCMessage, IntoOSCMessage, OSCPacket, OSCType, VMCError, VMCResult};

Expand Down Expand Up @@ -724,8 +723,8 @@ impl Time {

/// Creates a new time message, automatically tracking relative time using a monotonic clock.
pub fn elapsed() -> Self {
static EPOCH: Lazy<Instant> = Lazy::new(Instant::now);
Self(EPOCH.elapsed().as_secs_f32())
static EPOCH: OnceLock<Instant> = OnceLock::new();
Self(EPOCH.get_or_init(Instant::now).elapsed().as_secs_f32())
}
}

Expand Down

0 comments on commit be2ba23

Please sign in to comment.