gpp_solver/reexported/mod.rs
1//! This module contains reexported symbols that are imported from different places depending on
2//! how the crate was compiled.
3//!
4//! Modules:
5//!
6//! - [`iter`]: rust's `iter` module. Can come from `std` or the `core` crate.
7//! - [`mem`]: rust's `mem` module. Can come from `std` or the `alloc` crate.
8//!
9//! Macros:
10//!
11//! - [`format`]: rust's `format` macro. Can come from `std` or the `alloc` crate.
12//! - [`test`]: test macro for asynchronous code. Can come from `futures-test`, `tokio`, or the
13//! `async-std` crates. Only available during testing.
14//!
15//! Structs:
16//!
17//! - [`Arc`]: rust's `Arc` struct. Can come from `std` or the `alloc` crate.
18//! - [`Box`]: rust's `Box` struct. Can come from `std` or the `alloc` crate.
19//! - [`Map`]: one of rust's map types, either `HashMap` from `std` or `BTreeMap` from the `alloc`
20//! crate.
21//! - [`Mutex`]: a futures-aware mutex. Can come from `futures`, `tokio`, or the `async-lock`
22//! crates.
23//! - [`NonZeroUsize`]: rust's `NonZeroUsize` struct. Can come from `std` or the `core` crate.
24//! - [`Pin`]: rust's `Pin` struct. Can come from `std` or the `core` crate.
25//! - [`Set`]: one of rust's set types, either `HashSet` from `std` or `BTreeSet` from the `alloc`
26//! crate.
27//! - [`Vec`]: rust's `Vec` struct. Can come from `std` or the `alloc` crate.
28//!
29//! Traits:
30//!
31//! - [`Future`]: rust's `Future` trait. Can come from `std` or the `core` crate.
32//! - [`IntoIterator`]: rust's `IntoIterator` trait. Can come from `std` or the `core` crate.
33//! - [`Iterator`]: rust's `IntoIterator` trait. Can come from `std` or the `core` crate.
34
35#[cfg(not(any(
36 feature = "futures-lock",
37 feature = "tokio-lock",
38 feature = "async-std-lock"
39)))]
40compile_error!(
41 "Must enable one of: futures-lock, tokio-lock, or async-std-lock"
42);
43
44#[cfg(test)]
45pub use crate::reexported::test::*;
46
47#[cfg(test)]
48mod test;
49
50feature_cfg! {
51 for "std";
52
53 use std::collections::{HashMap, HashSet};
54
55 pub use std::{
56 boxed::Box,
57 format,
58 future::Future,
59 iter::{self, IntoIterator, Iterator},
60 mem,
61 num::NonZeroUsize,
62 pin::Pin,
63 sync::Arc,
64 vec::Vec,
65 };
66
67 pub type Map<K, V> = HashMap<K, V>;
68 pub type Set<T> = HashSet<T>;
69}
70
71feature_cfg! {
72 for !"std";
73
74 extern crate alloc;
75
76 use alloc::collections::{BTreeMap, BTreeSet};
77
78 pub use alloc::{
79 boxed::Box,
80 format,
81 sync::Arc,
82 vec::Vec,
83 };
84 pub use core::{
85 future::Future,
86 iter::{self, IntoIterator, Iterator},
87 mem,
88 num::NonZeroUsize,
89 pin::Pin,
90 };
91
92 pub type Map<K, V> = BTreeMap<K, V>;
93 pub type Set<T> = BTreeSet<T>;
94}
95
96feature_cfg! {
97 for "futures-lock";
98
99 pub use futures::lock::Mutex;
100}
101
102feature_cfg! {
103 for "tokio-lock";
104
105 pub use tokio::sync::Mutex;
106}
107
108feature_cfg! {
109 for "async-std-lock";
110
111 pub use async_lock::Mutex;
112}