Skip to main content

trait_kit/
prelude.rs

1// Copyright (c) 2026 Kirky.X
2//
3// Licensed under the MIT License
4// See LICENSE file in the project root for full license information.
5
6//! Re-exports of the most commonly used types and traits.
7
8pub use crate::core::error::KitError;
9pub use crate::core::meta::{AutoBuilder, ModuleMeta};
10pub use crate::kit::{Kit, Ready, Unbuilt};
11
12#[cfg(feature = "async")]
13pub use crate::core::meta::AsyncAutoBuilder;
14#[cfg(feature = "async")]
15pub use crate::{AsyncKit, AsyncReady, AsyncUnbuilt};
16
17#[cfg(feature = "confers")]
18pub use crate::kit::config::Configurable;
19
20#[cfg(feature = "confers-macros")]
21pub use crate::kit::config::ModuleConfig;
22
23#[cfg(all(test, feature = "async"))]
24mod tests {
25    //! Verify the async re-exports reachable through `prelude::*` compile
26    //! against the expected concrete types (`async_kit::Ready` / `Unbuilt`), not
27    //! the sync variants. This guards against a regression where lib.rs
28    //! aliases the wrong `Ready`/`Unbuilt` markers.
29    use crate::kit::async_kit::{Ready as AsyncReadyMarker, Unbuilt as AsyncUnbuiltMarker};
30    use crate::prelude::*;
31
32    #[test]
33    fn prelude_async_kit_compiles() {
34        let _ = AsyncKit::new();
35    }
36
37    #[test]
38    fn prelude_async_markers_match_async_kit_markers() {
39        fn assert_same_type<T, U>()
40        where
41            T: std::any::Any + 'static,
42            U: std::any::Any + 'static,
43        {
44            assert_eq!(
45                std::any::TypeId::of::<T>(),
46                std::any::TypeId::of::<U>(),
47                "prelude marker diverged from async_kit marker"
48            );
49        }
50        assert_same_type::<AsyncReady, AsyncReadyMarker>();
51        assert_same_type::<AsyncUnbuilt, AsyncUnbuiltMarker>();
52    }
53
54    #[allow(dead_code, reason = "trait presence check only")]
55    fn _async_auto_builder_is_in_prelude<M: AsyncAutoBuilder>() {}
56}