Skip to main content

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//! - The [`numa module`](numa) provides sufficient utilities for working with NUMA nodes.
15//! - Configuration macros that are used to right compile the program based on the target platform
16//!   such as [`config_target_pointer_width_64`], [`config_target_pointer_width_32`], and
17//!   [`config_target_pointer_width_16`].
18
19#![cfg_attr(feature = "no_std", no_std)]
20#![deny(clippy::all)]
21#![deny(clippy::assertions_on_result_states)]
22#![deny(clippy::match_wild_err_arm)]
23#![deny(clippy::allow_attributes_without_reason)]
24#![warn(clippy::pedantic)]
25#![warn(clippy::nursery)]
26#![warn(clippy::cargo)]
27#![allow(async_fn_in_trait, reason = "It improves readability.")]
28#![allow(
29    clippy::missing_const_for_fn,
30    reason = "Since we cannot make a constant function non-constant after its release,
31    we need to look for a reason to make it constant, and not vice versa."
32)]
33#![allow(clippy::inline_always, reason = "We write highly optimized code.")]
34#![allow(
35    clippy::must_use_candidate,
36    reason = "It is better to developer think about it."
37)]
38#![allow(
39    clippy::module_name_repetitions,
40    reason = "This is acceptable most of the time."
41)]
42#![allow(
43    clippy::missing_errors_doc,
44    reason = "Unless the error is something special,
45    the developer should document it."
46)]
47#![allow(clippy::redundant_pub_crate, reason = "It improves readability.")]
48#![allow(clippy::struct_field_names, reason = "It improves readability.")]
49#![allow(
50    clippy::module_inception,
51    reason = "It is fine if a file in has the same mane as a module."
52)]
53#![allow(clippy::if_not_else, reason = "It improves readability.")]
54#![allow(
55    rustdoc::private_intra_doc_links,
56    reason = "It allows to create more readable docs."
57)]
58#![allow(
59    clippy::negative_feature_names,
60    reason = "It is needed to allow the `no_std` feature."
61)]
62
63extern crate alloc;
64extern crate core;
65
66mod array_buffer;
67mod array_queue;
68pub mod backoff;
69pub mod cache_padded;
70mod clear_with;
71mod config_macro;
72pub mod hints;
73#[cfg(not(feature = "no_std"))]
74mod instant;
75pub mod light_arc;
76pub mod numa;
77pub mod number_key_map;
78mod vec_queue;
79
80pub use array_buffer::ArrayBuffer;
81pub use array_queue::ArrayQueue;
82pub use clear_with::*;
83#[cfg(not(feature = "no_std"))]
84pub use instant::OrengineInstant;
85#[cfg(not(feature = "no_std"))]
86pub use number_key_map::NumberKeyMap;
87pub use vec_queue::VecQueue;