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_stable")), // if features are incomplete…
19    allow(rustdoc::broken_intra_doc_links) // …allow broken intra-doc links
20)]
21//
22// environment
23//
24#![cfg_attr(not(feature = "std"), no_std)]
25// #![no_implicit_prelude] //?
26//
27// safety
28//
29#![cfg_attr(feature = "safe", forbid(unsafe_code))]
30//
31// nightly
32//
33// (In sync with Cargo.toml::nightly & build/features.rs::NIGHTLY)
34#![cfg_attr(feature = "nightly_allocator", feature(allocator_api))]
35#![cfg_attr(feature = "nightly_autodiff", feature(autodiff))]
36#![cfg_attr(feature = "nightly_bigint", feature(bigint_helper_methods))]
37#![cfg_attr(feature = "nightly_coro", feature(coroutines, coroutine_trait, iter_from_coroutine))]
38#![cfg_attr(feature = "nightly_doc", feature(doc_cfg, doc_notable_trait))]
39#![cfg_attr(all(feature = "nightly_doc", miri), allow(unused_attributes))]
40#![cfg_attr(all(feature = "nightly_doc", not(doc)), allow(unused_attributes))]
41#![cfg_attr(feature = "nightly_float", feature(f16, f128))]
42#![cfg_attr(feature = "nightly_simd", feature(portable_simd))]
43//
44// "nightly_stable" includes:
45// ----------------------------
46// "nightly_stable_next1": 1.86 core, alloc, std…
47#![cfg_attr(feature = "nightly_stable_next1", feature(
48    const_black_box,
49    const_is_char_boundary,
50    float_next_up_down,
51    get_many_mut, //  get_disjoint_mut
52    non_zero_count_ones,
53    target_feature_11,
54    trait_upcasting,
55))]
56#![cfg_attr(all(feature = "nightly_stable_next1", feature = "alloc"), feature(vec_pop_if,))]
57#![cfg_attr(
58    all(feature = "nightly_stable_next1", feature = "std"),
59    feature(const_mut_cursor, map_many_mut,)
60)]
61// ----------------------------
62// "nightly_stable_next2": 1.87 core, alloc, std…
63#![cfg_attr(
64    feature = "nightly_stable_next2",
65    feature(
66        const_slice_flatten,
67        integer_sign_cast,
68        num_midpoint_signed,
69        const_ptr_sub_ptr,
70        const_str_from_utf8,
71        ptr_sub_ptr,
72        unbounded_shifts,
73        unsigned_is_multiple_of
74    )
75)]
76#![cfg_attr(all(feature = "nightly_stable_next2", feature = "alloc"), feature(extract_if,))]
77#![cfg_attr(
78    all(feature = "nightly_stable_next2", feature = "std"),
79    feature(file_lock, hash_extract_if, os_str_display,)
80)]
81// ----------------------------
82// "nightly_stable_later": 1.?? core, alloc, std, not(miri)…
83#![cfg_attr(
84    feature = "nightly_stable_later",
85    feature(
86        asm_goto,
87        assert_matches,
88        cell_update,
89        const_array_from_ref,
90        const_slice_from_ref,
91        const_str_split_at,
92        const_swap_nonoverlapping,
93        c_str_module,
94        derive_coerce_pointee,
95        impl_trait_in_assoc_type,
96        isqrt,
97        let_chains,
98        macro_metavar_expr,
99        naked_functions,
100        slice_take,
101        unsafe_cell_from_mut,
102    )
103)]
104#![cfg_attr(
105    all(feature = "nightly_stable_later", feature = "alloc"),
106    feature(box_uninit_write, new_zeroed_alloc, const_vec_string_slice,)
107)]
108#![cfg_attr(
109    all(feature = "nightly_stable_later", feature = "std"),
110    feature(anonymous_pipe, once_wait,)
111)]
112// #![cfg_attr(all(feature = "nightly_stable_later", not(miri)), feature())]
113
114/* global safeguards */
115
116// environment
117#[cfg(all(feature = "std", feature = "no_std"))]
118compile_error!("You can't enable the `std` and `no_std` features at the same time.");
119// safety
120#[cfg(all(
121    feature = "safe",
122    // In sync with Cargo.toml::unsafe & build/features.rs::UNSAFE
123    any(feature = "unsafe", // includes all 11 specific purposes below:
124        feature = "unsafe_array", feature = "unsafe_ffi", feature = "unsafe_hint",
125        feature = "unsafe_layout", feature = "unsafe_niche", feature = "unsafe_ptr",
126        feature = "unsafe_slice", feature = "unsafe_str", feature = "unsafe_sync",
127        feature = "unsafe_syscall", feature = "unsafe_thread",
128    )
129))]
130compile_error!("You can't enable `safe` and any `unsafe*` features at the same time.");
131// (note: you can enable `safe_*` features to prevent `unsafe` use in specific modules)
132
133// https://doc.rust-lang.org/nightly/reference/names/preludes.html#extern-prelude
134extern crate self as devela;
135
136/* root modules */
137
138pub mod code;
139pub mod data;
140pub mod lang;
141pub mod media;
142pub mod num;
143pub mod phys;
144pub mod sys;
145pub mod text;
146pub mod ui;
147pub mod work;
148
149/// <span class='stab portability' title='re-exported `core`'>`core`</span>
150/// *Re-exported Rust `core` library.*
151#[doc(inline)]
152pub use ::core as _core;
153
154pub mod _dep;
155pub mod _info;
156
157/* structural re-exports */
158
159#[doc(hidden)]
160pub use all::*;
161pub mod all {
162    // public items, feature-gated, visible at their origin and here in `all`
163    //
164    //! All the crate's items flat re-exported.
165    //! <br/><hr>
166    //!
167    //! Note that these items are already re-exported (hidden) from the root,
168    //! as is every other public module's contents from their parent.
169    #[allow(unused_imports)]
170    #[rustfmt::skip]
171    #[doc(inline)]
172    pub use super::{
173        code::_all::*,
174        data::_all::*,
175        lang::_all::*,
176        media::_all::*,
177        num::_all::*,
178        phys::_all::*,
179        sys::_all::*,
180        text::_all::*,
181        ui::_all::*,
182        work::_all::*,
183        //
184        _always::*,
185    };
186}
187mod _always {
188    // public items, not as much feature-gated, bubbled up
189    #[allow(unused_imports)]
190    #[rustfmt::skip]
191    pub use super::{
192        code::_always::*,
193        data::_always::*,
194        lang::_always::*,
195        media::_always::*,
196        num::_always::*,
197        phys::_always::*,
198        sys::_always::*,
199        text::_always::*,
200        // ui::_always::*,
201        work::_always::*,
202    };
203}
204#[doc(hidden)]
205pub use _hidden::*;
206mod _hidden {
207    // public, hidden items
208    pub use super::sys::_hidden::*;
209}
210#[allow(unused_imports)]
211pub(crate) use _internals::*;
212mod _internals {
213    // private, internal items
214    #[allow(unused_imports)]
215    #[rustfmt::skip]
216    pub(crate) use super::{
217        code::_internals::*,
218        data::_internals::*,
219        num::_internals::*,
220    };
221}