Skip to main content

zng_task/
reexports.rs

1/// Recommended blocking locks.
2///
3/// The `Mutex` and `RwLock` types reexported here are recommended, they are
4/// more optimized than `std` alternatives because they don't implement lock poisoning,
5/// have `const` initialization and integrate with the `zng` feature `"deadlock_detection"`.
6///
7/// # Full API
8///
9/// See the [`parking_lot`] crate for the full API.
10///
11/// [`parking_lot`]: https://docs.rs/parking_lot
12pub mod parking_lot {
13    #[doc(no_inline)]
14    pub use ::parking_lot::{
15        ArcMutexGuard, ArcRwLockReadGuard, ArcRwLockWriteGuard, Condvar, MappedMutexGuard, MappedRwLockReadGuard, MappedRwLockWriteGuard,
16        Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockUpgradableReadGuard, RwLockWriteGuard,
17    };
18}
19
20/// Parallel iterators.
21///
22/// This module mostly reexports the primary traits from the [`rayon`] crate.
23///
24/// This module also includes [`ParallelIteratorWithCtx`] that propagates the
25/// zng app context to rayon tasks.
26///
27/// # Full API
28///
29/// See the [`rayon`] crate for the full API.
30///
31/// [`rayon`]: https://docs.rs/rayon
32/// [`ParallelIteratorWithCtx`]: crate::rayon::ParallelIteratorWithCtx
33pub mod rayon {
34    #[doc(no_inline)]
35    pub use ::rayon::{iter, slice, str};
36
37    pub use crate::rayon_ctx::*;
38
39    /// Rayon traits imported `as _`.
40    pub mod prelude {
41        #[doc(no_inline)]
42        pub use ::rayon::{
43            iter::FromParallelIterator as _, iter::IndexedParallelIterator as _, iter::IntoParallelIterator as _,
44            iter::IntoParallelRefIterator as _, iter::IntoParallelRefMutIterator as _, iter::ParallelBridge as _,
45            iter::ParallelDrainFull as _, iter::ParallelDrainRange as _, iter::ParallelExtend as _, iter::ParallelIterator as _,
46            slice::ParallelSlice as _, slice::ParallelSliceMut as _, str::ParallelString as _,
47        };
48
49        pub use super::ParallelIteratorExt as _;
50    }
51}