1pub struct Init {
19 __private: ()
20}
21
22pub struct Uninit {
23 __private: ()
24}
25
26#[diagnostic::on_unimplemented(
28 message = "a required field is not initialised",
29 note = "call a builder method for the missing required field before building"
31)]
32pub trait IsInit {}
33
34impl IsInit for Init {}
35
36#[diagnostic::on_unimplemented(
38 message = "this field is already initialised",
39 label = "this field is already initialised",
40 note = "omit this builder method call, or a previous builder method call that has set this field, or call a builder method to erase this field"
41)]
42pub trait IsUninit {}
43
44impl IsUninit for Uninit {}
45
46pub trait InitStatus {
47 const IS_INIT: bool;
48 const IS_UNINIT: bool = !Self::IS_INIT;
49}
50
51impl InitStatus for Init {
52 const IS_INIT: bool = true;
53}
54
55impl InitStatus for Uninit {
56 const IS_INIT: bool = false;
57}
58
59pub type PhantomDataInvariant<T> = std::marker::PhantomData<fn(T) -> T>;