1#[cfg(feature = "clonable-lock")]
2mod fxlock;
3mod fxproxy;
4
5#[cfg(all(feature = "async-tokio", feature = "async-lock", not(docsrs)))]
6compile_error!(
7 "Both `async-tokio` and `async-lock` features cannot be enabled at the same time. Please, choose one of them."
8);
9
10#[cfg(not(any(feature = "async-tokio", feature = "async-lock")))]
11compile_error!("Either `async-tokio` or `async-lock` feature must be enabled. Please, choose one of them.");
12
13#[cfg(feature = "clonable-lock")]
14pub use fxlock::FXRwLock;
15#[doc(hidden)]
16pub use fxproxy::FXBuilderFallible;
17#[doc(hidden)]
18pub use fxproxy::FXBuilderInfallible;
19pub use fxproxy::FXProxy;
20pub use fxproxy::FXProxyReadGuard;
21pub use fxproxy::FXProxyWriteGuard;
22pub use fxproxy::FXWriter;
23#[cfg(feature = "async-tokio")]
24#[cfg_attr(feature = "async-tokio", doc(hidden))]
25pub use tokio::sync::OnceCell;
26#[cfg(feature = "async-tokio")]
27#[cfg_attr(feature = "async-tokio", doc(hidden))]
28pub use tokio::sync::RwLock;
29#[cfg(feature = "async-tokio")]
30#[cfg_attr(feature = "async-tokio", doc(hidden))]
31pub use tokio::sync::RwLockReadGuard;
32#[cfg(feature = "async-tokio")]
33#[cfg_attr(feature = "async-tokio", doc(hidden))]
34pub use tokio::sync::RwLockWriteGuard;
35
36#[cfg(all(feature = "async-lock", not(docsrs)))]
37#[cfg_attr(feature = "async-lock", doc(hidden))]
38pub use async_lock::OnceCell;
39#[cfg(all(feature = "async-lock", not(docsrs)))]
40#[cfg_attr(feature = "async-lock", doc(hidden))]
41pub use async_lock::RwLock;
42#[cfg(all(feature = "async-lock", not(docsrs)))]
43#[cfg_attr(feature = "async-lock", doc(hidden))]
44pub use async_lock::RwLockReadGuard;
45#[cfg(all(feature = "async-lock", not(docsrs)))]
46#[cfg_attr(feature = "async-lock", doc(hidden))]
47pub use async_lock::RwLockWriteGuard;
48
49#[inline(always)]
50pub fn new_lazy_container<T>(value: Option<T>) -> OnceCell<T> {
51 if let Some(v) = value {
52 OnceCell::from(v)
53 }
54 else {
55 OnceCell::new()
56 }
57}