bon/__/mod.rs
1#![allow(
2 // We place `#[inline(always)]` only on very small methods where we'd event want
3 // a guarantee of them being inlined.
4 clippy::inline_always,
5
6 // Marking every potential function as `const` is a bit too much.
7 // Especially, this doesn't play well with our MSRV. Trait bounds
8 // aren't allowed on const functions in older Rust versions.
9 clippy::missing_const_for_fn,
10)]
11
12/// Used for providing better IDE hints (completions and syntax highlighting).
13pub mod ide;
14
15pub mod better_errors;
16
17mod cfg_eval;
18
19// This reexport is a private implementation detail and should not be used
20// directly! This reexport may change or be removed at any time between
21// patch releases. Use the export from your generated builder's state module
22// directly instead of using this reexport from `bon::__`.
23pub use crate::builder_state::{IsSet, IsUnset};
24pub use rustversion;
25
26pub(crate) mod sealed {
27 // The purpose of the `Sealed` trait **is** to be unnameable from outside the crate.
28 #[allow(unnameable_types)]
29 pub trait Sealed: Sized {}
30
31 impl<Name> Sealed for super::Unset<Name> {}
32 impl<Name> Sealed for super::Set<Name> {}
33}
34
35pub(crate) use sealed::Sealed;
36
37/// Used to implement the `alloc` feature.
38#[cfg(feature = "alloc")]
39pub extern crate alloc;
40
41#[derive(Debug)]
42pub struct Unset<Name>(Name);
43
44#[derive(Debug)]
45pub struct Set<Name>(Name);