orengine_utils/
lib.rs

1//! This crate provides some useful utilities.
2//!
3//! - The [`hints module`](hints) provides hints to the compiler that affects how code
4//!   should be emitted or optimized.
5//! - The [`backoff module`](backoff) provides the [`Backoff`](backoff::Backoff) structure.
6//! - The [`cache_padded module`](cache_padded) provides cache-padded atomics types and
7//!   the [`CachePadded`] wrapper.
8//! - The [`light_arc module`](light_arc) provides the [`LightArc`](light_arc::LightArc) type.
9//! - The [`OrengineInstant`] that is a monotone clock that weights 8 bytes on Unix-like systems.
10//! - The [`ArrayQueue`] that is an array-based queue implementation.
11//! - The [`VecQueue`] that is a vector-based queue implementation.
12//! - The [`NumberKeyMap`] that is a compact open-addressing map specialized for `usize`
13//!   keys optimized for zero-misses and so optimized for 99+% reading operations.
14//! - Configuration macros that are used to right compile the program based on the target platform
15//!   such as [`config_target_pointer_width_64`], [`config_target_pointer_width_32`], and
16//!   [`config_target_pointer_width_16`].
17
18#![cfg_attr(feature = "no_std", no_std)]
19#![deny(clippy::all)]
20#![deny(clippy::assertions_on_result_states)]
21#![deny(clippy::match_wild_err_arm)]
22#![deny(clippy::allow_attributes_without_reason)]
23#![warn(clippy::pedantic)]
24#![warn(clippy::nursery)]
25#![warn(clippy::cargo)]
26#![allow(async_fn_in_trait, reason = "It improves readability.")]
27#![allow(
28    clippy::missing_const_for_fn,
29    reason = "Since we cannot make a constant function non-constant after its release,
30    we need to look for a reason to make it constant, and not vice versa."
31)]
32#![allow(clippy::inline_always, reason = "We write highly optimized code.")]
33#![allow(
34    clippy::must_use_candidate,
35    reason = "It is better to developer think about it."
36)]
37#![allow(
38    clippy::module_name_repetitions,
39    reason = "This is acceptable most of the time."
40)]
41#![allow(
42    clippy::missing_errors_doc,
43    reason = "Unless the error is something special,
44    the developer should document it."
45)]
46#![allow(clippy::redundant_pub_crate, reason = "It improves readability.")]
47#![allow(clippy::struct_field_names, reason = "It improves readability.")]
48#![allow(
49    clippy::module_inception,
50    reason = "It is fine if a file in has the same mane as a module."
51)]
52#![allow(clippy::if_not_else, reason = "It improves readability.")]
53#![allow(
54    rustdoc::private_intra_doc_links,
55    reason = "It allows to create more readable docs."
56)]
57#![allow(
58    clippy::negative_feature_names,
59    reason = "It is needed to allow the `no_std` feature."
60)]
61
62extern crate alloc;
63
64mod array_buffer;
65mod array_queue;
66pub mod backoff;
67pub mod cache_padded;
68mod clear_with;
69mod config_macro;
70pub mod hints;
71#[cfg(not(feature = "no_std"))]
72mod instant;
73pub mod light_arc;
74pub mod number_key_map;
75mod vec_queue;
76
77pub use array_buffer::ArrayBuffer;
78pub use array_queue::ArrayQueue;
79pub use clear_with::*;
80#[cfg(not(feature = "no_std"))]
81pub use instant::OrengineInstant;
82#[cfg(not(feature = "no_std"))]
83pub use number_key_map::NumberKeyMap;
84pub use vec_queue::VecQueue;