adze_concurrency_env_core/
lib.rs1#![forbid(unsafe_op_in_unsafe_fn)]
4#![deny(missing_docs)]
5#![cfg_attr(feature = "strict_api", deny(unreachable_pub))]
6#![cfg_attr(not(feature = "strict_api"), warn(unreachable_pub))]
7#![cfg_attr(feature = "strict_docs", deny(missing_docs))]
8#![cfg_attr(not(feature = "strict_docs"), allow(missing_docs))]
9
10pub use adze_concurrency_env_contract_core::*;
11
12#[cfg(test)]
13mod tests {
14 use super::*;
15
16 #[test]
17 fn reexported_defaults_are_accessible() {
18 assert_eq!(DEFAULT_RAYON_NUM_THREADS, 4);
19 assert_eq!(DEFAULT_TOKIO_WORKER_THREADS, 2);
20 }
21
22 #[test]
23 fn reexported_caps_construct_via_lookup() {
24 let caps = ConcurrencyCaps::from_lookup(|_| None);
25 assert_eq!(caps.rayon_threads, DEFAULT_RAYON_NUM_THREADS);
26 assert_eq!(caps.tokio_worker_threads, DEFAULT_TOKIO_WORKER_THREADS);
27 }
28
29 #[test]
30 fn reexported_parse_helper_works() {
31 assert_eq!(parse_positive_usize_or_default(Some("5"), 1), 5);
32 assert_eq!(parse_positive_usize_or_default(None, 7), 7);
33 assert_eq!(parse_positive_usize_or_default(Some("0"), 3), 3);
34 }
35
36 #[test]
37 fn reexported_caps_default_impl() {
38 let caps = ConcurrencyCaps::default();
39 assert_eq!(caps, ConcurrencyCaps::from_lookup(|_| None));
40 }
41}