Skip to content

Commit

Permalink
re-add atomic dep to support thumbv6m
Browse files Browse the repository at this point in the history
  • Loading branch information
rrichardson committed Aug 23, 2022
1 parent 1b8dfdf commit dbe1c7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ repository = "uuid-rs/uuid"
default = ["std"]
std = []
macro-diagnostics = ["private_uuid-macro-internal"]
v1 = []
v1 = ["private_atomic"]
v3 = ["md5"]
v4 = ["rng"]
v5 = ["sha1"]
v6 = []
v6 = ["private_atomic"]
v7 = ["rng"]
v8 = []
js = ["private_getrandom", "private_getrandom/js"]
Expand Down Expand Up @@ -134,6 +134,12 @@ version = "1.1.2"
path = "macros"
optional = true

[dependencies.private_atomic]
package = "atomic"
default-features = false
optional = true
version = "0.5"

[dev-dependencies.bincode]
version = "1.0"

Expand Down
10 changes: 5 additions & 5 deletions src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ impl<'a, T: ClockSequence + ?Sized> ClockSequence for &'a T {
}

/// For features v1 and v1, constructs a `Context` struct which implements the `ClockSequence` trait
#[cfg(any(feature = "v1", feature = "v6", feature = "v7"))]
#[cfg(any(feature = "v1", feature = "v6"))]
pub mod context {
use std::sync::atomic::{AtomicU16, Ordering};
use private_atomic::{Atomic, Ordering};
/// A thread-safe, stateful context for the v1 generator to help ensure
/// process-wide uniqueness.
#[derive(Debug)]
pub struct Context {
count: AtomicU16,
count: Atomic<u16>,
}

impl Context {
Expand All @@ -133,7 +133,7 @@ pub mod context {
/// process.
pub const fn new(count: u16) -> Self {
Self {
count: AtomicU16::new(count),
count: Atomic::<u16>::new(count),
}
}

Expand All @@ -151,7 +151,7 @@ pub mod context {
#[cfg(feature = "rng")]
pub fn new_random() -> Self {
Self {
count: AtomicU16::new(crate::rng::u16()),
count: Atomic::<u16>::new(crate::rng::u16()),
}
}
}
Expand Down

0 comments on commit dbe1c7c

Please sign in to comment.