Skip to main content

trait_kit/
prelude.rs

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