Skip to content

Commit ee9a95b

Browse files
committed
refactor: use bevy-style scopes
1 parent 5a4d1bc commit ee9a95b

File tree

4 files changed

+473
-224
lines changed

4 files changed

+473
-224
lines changed

rayon-compat/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ where
8383
pub use forte::Scope;
8484

8585
#[inline(always)]
86-
pub fn scope<'scope, OP, R>(op: OP) -> R
86+
pub fn scope<OP, R>(op: OP) -> Option<R>
8787
where
88-
OP: FnOnce(&Scope<'scope>) -> R + Send,
88+
OP: for<'scope> FnOnce(&'scope Scope<'scope, '_>) -> R + Send,
8989
R: Send,
9090
{
9191
ensure_started();
9292
forte::scope(op)
9393
}
9494

9595
#[inline(always)]
96-
pub fn in_place_scope<'scope, OP, R>(op: OP) -> R
96+
pub fn in_place_scope<OP, R>(op: OP) -> Option<R>
9797
where
98-
OP: FnOnce(&Scope<'scope>) -> R,
98+
OP: for<'scope> FnOnce(&'scope Scope<'scope, '_>) -> R,
9999
{
100100
ensure_started();
101101
forte::scope(op)

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ mod platform {
7373
pub use alloc::sync::Arc;
7474
pub use alloc::sync::Weak;
7575
pub use core::sync::atomic::AtomicBool;
76+
pub use core::sync::atomic::AtomicPtr;
7677
pub use core::sync::atomic::AtomicU32;
7778
pub use core::sync::atomic::Ordering;
7879
pub use std::sync::Barrier;
@@ -95,6 +96,7 @@ mod platform {
9596
pub use shuttle::sync::Mutex;
9697
pub use shuttle::sync::Weak;
9798
pub use shuttle::sync::atomic::AtomicBool;
99+
pub use shuttle::sync::atomic::AtomicPtr;
98100
pub use shuttle::sync::atomic::AtomicU32;
99101
pub use shuttle::sync::atomic::Ordering;
100102
pub use shuttle::thread::Builder as ThreadBuilder;

0 commit comments

Comments
 (0)