scsys_core/
lib.rs

1/*
2    Appellation: scsys-core <library>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5//! # scsys-core
6//!
7//! Welcome the the scsys-core` crate, the foundational library for the [scsys.io](https://scsys.io)
8//! ecosystem. This crate is primarily focused on establish a set of fundamental types, traits,
9//! and utilities that are used throughout the ecosystem. Doing so allows for a natural
10//! consistency to emerge across the ecosystem, while further streamlining the development
11//! process.
12//!
13//! That being said, the general focus of the crate and its feature-gating make it ideally
14//! suited for use outside of the ecosystem as well providing useful primitives such as:
15//!
16//! - [`Id`](id::Id) - a generic identifier type
17//!
18#![allow(
19    non_snake_case,
20    clippy::module_inception,
21    clippy::missing_safety_doc,
22    clippy::needless_doctest_main,
23    clippy::upper_case_acronyms
24)]
25#![cfg_attr(not(feature = "std"), no_std)]
26#![cfg_attr(all(feature = "alloc", feature = "nightly"), feature(allocator_api))]
27#![doc(
28    html_logo_url = "https://raw.githubusercontent.com/scattered-systems/.github/main/assets/logo.png",
29    html_favicon_url = "https://raw.githubusercontent.com/scattered-systems/.github/main/assets/favicon.ico"
30)]
31
32#[cfg(feature = "alloc")]
33extern crate alloc;
34
35// re-import the `rand` & `rand_distr` crates if the `rand` feature is enabled
36#[cfg(feature = "rand")]
37pub use rand;
38#[cfg(feature = "rand")]
39pub use rand_distr;
40
41#[doc(inline)]
42pub use scsys_state as state;
43#[doc(inline)]
44#[cfg(feature = "time")]
45pub use scsys_time as time;
46
47#[macro_use]
48pub(crate) mod macros {
49    #[macro_use]
50    pub mod gsw;
51    #[macro_use]
52    pub mod seal;
53    #[macro_use]
54    pub mod wrapper;
55}
56
57#[doc(inline)]
58pub use self::{
59    error::{Error, Result},
60    id::Id,
61    types::prelude::*,
62};
63
64#[doc(inline)]
65pub use scsys_state::{NState, State, StateBase, StateRepr, Stateful};
66#[cfg(feature = "time")]
67pub use scsys_time::{Now, RawTimestamp, Timestamp};
68
69/// this module implements a set of traits and utilities for working with containers
70pub mod cont;
71/// this module implements various error-handling primitives and utilities
72pub mod error;
73/// this module defines the generic [`Id`] wrapper and its implementations
74pub mod id;
75
76pub mod types {
77    #[doc(inline)]
78    pub use self::prelude::*;
79
80    /// this module implements the [`LinearDirection`], an enumeration over all possible
81    /// movements in one-dimensional space.
82    pub mod direction;
83    pub mod stages;
84
85    pub(crate) mod prelude {
86        #[allow(unused_imports)]
87        #[doc(inline)]
88        pub use super::aliases::*;
89        #[doc(inline)]
90        pub use super::direction::*;
91        #[doc(inline)]
92        pub use super::stages::*;
93    }
94
95    pub(crate) mod aliases {
96        #[cfg(feature = "alloc")]
97        /// Type alias for a boxed error with send, sync, and static flags enabled
98        pub type BoxError = alloc::boxed::Box<dyn core::error::Error + Send + Sync + 'static>;
99        #[cfg(feature = "alloc")]
100        /// Type alias for the standard result used
101        pub type BoxResult<T = ()> = core::result::Result<T, BoxError>;
102    }
103}
104
105#[doc(hidden)]
106pub mod prelude {
107    #[cfg(feature = "time")]
108    pub use scsys_time::prelude::*;
109
110    pub use crate::cont::prelude::*;
111    pub use crate::id::prelude::*;
112    pub use crate::state::prelude::*;
113    pub use crate::types::prelude::*;
114}