1#![deny(unsafe_code)]
8#![warn(clippy::all, clippy::pedantic)]
9#![allow(clippy::module_name_repetitions)]
10#![doc = include_str!("../README.md")]
11
12pub mod core;
13mod error;
14pub mod kit;
15
16#[cfg(feature = "i18n")]
17pub mod i18n;
18
19pub mod prelude;
20
21pub use error::TraitKitError;
22
23#[cfg(feature = "async")]
24pub use core::AsyncAutoBuilder;
25#[cfg(feature = "async")]
26pub use kit::{AsyncKit, AsyncReady, AsyncUnbuilt};
27
28#[cfg(all(test, feature = "async"))]
34pub(crate) mod test_helpers {
35 use std::future::Future;
36 use std::task::{self, Poll};
37
38 pub(crate) fn block_on<F: Future>(future: F) -> F::Output {
43 let waker = task::Waker::noop();
44 #[allow(clippy::needless_borrow)]
47 let mut cx = task::Context::from_waker(&waker);
48 let mut future = std::pin::pin!(future);
49 loop {
50 match future.as_mut().poll(&mut cx) {
51 Poll::Ready(v) => return v,
52 Poll::Pending => std::hint::spin_loop(),
53 }
54 }
55 }
56
57 #[derive(Debug, thiserror::Error)]
59 #[allow(dead_code, reason = "mock error type verifies trait signature only")]
60 pub(crate) enum MockError {
61 #[error("mock build failed: {0}")]
62 Failed(String),
63 }
64}