devela/
lib.rs

1// devela::lib
2//
3//! A cohesive development layer.
4//!
5#![doc = include_str!("./Lib.md")]
6//
7
8/* global configuration */
9//
10// lints
11//
12// (Most lints are defined in Cargo.toml::lints)
13// https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html
14//
15// WAIT: [Per-crate-type lint configuration](https://github.com/rust-lang/cargo/issues/15046)
16#![deny(rustdoc::missing_crate_level_docs, rustdoc::missing_debug_implementations)]
17#![cfg_attr(
18    not(all(doc, feature = "_docsrs")), // if features are incomplete…
19    // not(all(doc, feature = "_docs", feature = "std")),
20    allow(rustdoc::broken_intra_doc_links) // …allow broken intra-doc links
21)]
22//
23// environment
24//
25#![cfg_attr(not(feature = "std"), no_std)]
26// #![no_implicit_prelude] //?
27//
28// safety
29//
30#![cfg_attr(feature = "safe", forbid(unsafe_code))]
31//
32// nightly (flags)
33//
34// ```
35// RUSTFLAGS="--cfg nightly_stable" cargo +nightly build
36// RUSTDOCFLAGS="--cfg nightly_stable" cargo +nightly doc
37// ```
38//
39// (In sync with ../Cargo.toml::[lints.rust.unexpected_cfgs] & ../build/features.rs::FLAGS_NIGHTLY)
40#![cfg_attr(nightly_allocator, feature(allocator_api))]
41// #![cfg_attr(nightly_autodiff, feature(autodiff))] // FLAG_DISABLED:nightly_autodiff
42#![cfg_attr(nightly_bigint, feature(bigint_helper_methods))]
43#![cfg_attr(nightly_coro, feature(coroutines, coroutine_trait, iter_from_coroutine))]
44#![cfg_attr(nightly_doc, feature(doc_cfg, doc_notable_trait))]
45#![cfg_attr(all(nightly_doc, miri), allow(unused_attributes))]
46#![cfg_attr(all(nightly_doc, not(doc)), allow(unused_attributes))]
47#![cfg_attr(nightly_float, feature(f16, f128))]
48#![cfg_attr(nightly_simd, feature(portable_simd))]
49//
50// `nightly_stable` includes:
51// ----------------------------
52// `nightly_stable_next1`: 1.89 core, alloc, std…
53#![cfg_attr(
54    nightly_stable_next1,
55    feature(
56        avx512_target_feature,
57        const_array_as_mut_slice,
58        keylocker_x86,
59        non_null_from_ref,
60        repr128,
61        result_flattening,
62        sha512_sm_x86,
63        stdarch_x86_avx512,
64    )
65)]
66// #![cfg_attr(all(nightly_stable_next1, feature = "alloc"), feature())]
67#![cfg_attr(
68    all(nightly_stable_next1, feature = "std"),
69    feature(file_lock, os_string_pathbuf_leak,)
70)]
71// ----------------------------
72// `nightly_stable_next2`: 1.90 core, alloc, std…
73#![cfg_attr(nightly_stable_next2, feature(const_slice_reverse, mixed_integer_ops_unsigned_sub,))]
74// #![cfg_attr(all(nightly_stable_next1, feature = "alloc"), feature())]
75#![cfg_attr(all(nightly_stable_next1, feature = "std"), feature(const_float_round_methods,))]
76// ----------------------------
77// `nightly_stable_later`: 1.?? core, alloc, std, not(miri)…
78#![cfg_attr(
79    nightly_stable_later,
80    feature(
81        as_array_of_cells,
82        assert_matches,
83        breakpoint,
84        cfg_select,
85        cfg_version,
86        const_array_each_ref,
87        const_array_from_ref,
88        const_char_classify,
89        const_slice_from_ref,
90        const_sockaddr_setters,
91        const_str_split_at,
92        const_type_id,
93        derive_coerce_pointee,
94        fn_align,
95        if_let_guard,
96        impl_trait_in_assoc_type,
97        ip_from,
98        isqrt,
99        macro_metavar_expr,
100        more_qualified_paths,
101        offset_of_enum,
102        offset_of_slice,
103        strict_overflow_ops,
104        substr_range,
105        unsafe_cell_from_mut,
106    )
107)]
108#![cfg_attr(all(nightly_stable_later, feature = "alloc"), feature(new_zeroed_alloc,))]
109#![cfg_attr(
110    all(nightly_stable_later, feature = "std"),
111    feature(once_wait, path_file_prefix, rwlock_downgrade,)
112)]
113// #![cfg_attr(all(nightly_stable_later, not(miri)), feature())]
114
115/* global safeguards */
116
117// environment
118#[cfg(all(feature = "std", feature = "no_std"))]
119compile_error!("You can't enable the `std` and `no_std` features at the same time.");
120// safety
121#[cfg(all(
122    feature = "safe",
123    // In sync with ../Cargo.toml::unsafe & ../build/features.rs::UNSAFE
124    any(feature = "unsafe", // includes all 11 specific purposes below:
125        feature = "unsafe_array", feature = "unsafe_ffi", feature = "unsafe_hint",
126        feature = "unsafe_layout", feature = "unsafe_niche", feature = "unsafe_ptr",
127        feature = "unsafe_slice", feature = "unsafe_str", feature = "unsafe_sync",
128        feature = "unsafe_syscall", feature = "unsafe_thread",
129    )
130))]
131compile_error!("You can't enable `safe` and any `unsafe*` features at the same time.");
132// (note: you can enable `safe_*` features to prevent `unsafe` use in specific modules)
133
134// https://doc.rust-lang.org/nightly/reference/names/preludes.html#extern-prelude
135extern crate self as devela;
136
137/* root modules */
138
139pub mod code;
140pub mod data;
141pub mod game;
142pub mod lang;
143pub mod media;
144pub mod num;
145pub mod phys;
146pub mod sys;
147pub mod text;
148pub mod ui;
149pub mod work;
150
151/// <span class='stab portability' title='re-exported `core`'>`core`</span>
152/// *Re-exported Rust `core` library.*
153#[doc(inline)]
154pub use ::core as _core;
155
156pub mod _dep;
157pub mod _info;
158
159/* structural re-exports */
160
161#[doc(hidden)]
162pub use all::*;
163pub mod all {
164    // public items, feature-gated, visible at their origin and here in `all`
165    //
166    //! All the crate's items flat re-exported.
167    //! <br/><hr>
168    //!
169    //! Note that these items are already re-exported (hidden) from the root,
170    //! as is every other public module's contents from their parent.
171    #[allow(unused_imports)]
172    #[rustfmt::skip]
173    #[doc(inline)]
174    pub use super::{
175        code::_all::*,
176        data::_all::*,
177        game::_all::*,
178        lang::_all::*,
179        media::_all::*,
180        num::_all::*,
181        phys::_all::*,
182        sys::_all::*,
183        text::_all::*,
184        ui::_all::*,
185        work::_all::*,
186        //
187        _always::*,
188    };
189}
190mod _always {
191    // public items, less feature-gated, bubble up easy
192    #[allow(unused_imports)]
193    #[rustfmt::skip]
194    pub use super::{
195        code::_always::*,
196        data::_always::*,
197        lang::_always::*,
198        // game::_always::*,
199        media::_always::*,
200        num::_always::*,
201        phys::_always::*,
202        sys::_always::*,
203        text::_always::*,
204        // ui::_always::*,
205        work::_always::*,
206    };
207}
208#[doc(hidden)]
209pub use _hidden::*;
210mod _hidden {
211    // public, hidden items
212    pub use super::sys::_hidden::*;
213}
214#[allow(unused_imports)]
215pub(crate) use _internals::*;
216mod _internals {
217    // private, internal items
218    #[allow(unused_imports)]
219    #[rustfmt::skip]
220    pub(crate) use super::{
221        code::_internals::*,
222        data::_internals::*,
223        lang::_internals::*,
224        media::_internals::*,
225        num::_internals::*,
226        sys::_internals::*,
227    };
228}