scc2/
lib.rs

1#![deny(missing_docs, warnings, clippy::all, clippy::pedantic)]
2#![doc = include_str!("../README.md")]
3
4pub mod bag;
5pub use bag::Bag;
6
7#[cfg(not(feature = "equivalent"))]
8mod equivalent;
9pub use equivalent::{Comparable, Equivalent};
10
11pub mod exit_guard;
12pub use exit_guard::{ExitGuard, Defer};
13
14pub mod atom;
15pub use atom::Atom;
16
17//pub mod chan;
18//pub use chan::Chan;
19
20pub mod hash_cache;
21pub use hash_cache::HashCache;
22
23pub mod hash_index;
24pub use hash_index::HashIndex;
25
26pub mod hash_map;
27pub use hash_map::HashMap;
28
29pub mod hash_set;
30pub use hash_set::HashSet;
31
32mod hash_table;
33
34mod linked_list;
35pub use linked_list::Entry as LinkedEntry;
36pub use linked_list::LinkedList;
37
38#[cfg(feature = "loom")]
39mod maybe_std {
40    pub(crate) use loom::sync::atomic::{AtomicU8, AtomicUsize};
41    pub(crate) use loom::thread::yield_now;
42}
43
44#[cfg(not(feature = "loom"))]
45mod maybe_std {
46    pub(crate) use std::sync::atomic::{AtomicU8, AtomicUsize};
47    pub(crate) use std::thread::yield_now;
48}
49
50pub mod queue;
51pub use queue::Queue;
52
53mod range_helper {
54    use crate::Comparable;
55    use std::ops::Bound::{Excluded, Included, Unbounded};
56    use std::ops::RangeBounds;
57
58    /// Emulates `RangeBounds::contains`.
59    pub(crate) fn contains<K, Q, R: RangeBounds<Q>>(range: &R, key: &K) -> bool
60    where
61        Q: Comparable<K> + ?Sized,
62    {
63        (match range.start_bound() {
64            Included(start) => start.compare(key).is_le(),
65            Excluded(start) => start.compare(key).is_lt(),
66            Unbounded => true,
67        }) && (match range.end_bound() {
68            Included(end) => end.compare(key).is_ge(),
69            Excluded(end) => end.compare(key).is_gt(),
70            Unbounded => true,
71        })
72    }
73}
74
75/// Re-exports the [`sdd`](https://crates.io/crates/sdd) crate for backward compatibility.
76pub use sdd;
77pub use sdd as ebr;
78
79#[cfg(feature = "serde")]
80mod serde;
81
82pub mod stack;
83pub use stack::Stack;
84
85#[cfg(test)]
86mod tests;
87
88pub mod tree_index;
89pub use tree_index::TreeIndex;
90
91mod wait_queue;