Skip to main content

imago/sync_primitives/
mod.rs

1//! Feature-agnostic synchronization primitives
2//!
3//! In async mode, re-exports `tokio::sync` types.  In sync mode, provides `std::sync` wrappers
4//! with a matching API.
5
6#[cfg(feature = "sync")]
7mod sync_impl;
8
9#[cfg(feature = "async")]
10#[allow(unused_imports)]
11pub(crate) use tokio::sync::{Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
12
13#[cfg(feature = "sync")]
14#[allow(unused_imports)]
15pub(crate) use std::sync::{MutexGuard, RwLockReadGuard, RwLockWriteGuard};
16#[cfg(feature = "sync")]
17#[allow(unused_imports)]
18pub(crate) use sync_impl::{Mutex, RwLock};