Skip to main content

derive_tools/
lib.rs

1#![ cfg_attr( feature = "no_std", no_std ) ]
2#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
3#![ doc
4(
5  html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico"
6) ]
7#![ doc( html_root_url = "https://docs.rs/derive_tools/latest/derive_tools/" ) ]
8#![ cfg_attr( doc, doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "readme.md" ) ) ) ]
9#![ cfg_attr( not( doc ), doc = "Derive macro tools" ) ]
10
11//! # Rule Compliance & Architectural Notes
12//!
13//! This crate has been systematically updated to comply with the Design and Codestyle Rulebooks.
14//! Key compliance achievements :
15//!
16//! ## Completed Compliance Work :
17//!
18//! 1. **Feature Architecture** : All functionality is properly gated behind the "enabled" feature
19//!    following the mandatory 'enabled' and 'full' features requirement.
20//!
21//! 2. **Dependencies** : Uses workspace dependency inheritance with `{ workspace = true }`.
22//!    All derive macro dependencies are centralized in the workspace Cargo.toml.
23//!
24//! 3. **Attribute Formatting** : All attributes use proper spacing per Universal Formatting Rule.
25//!
26//! 4. **Documentation Strategy** : Uses `#![ doc = include_str!(...) ]` to include readme.md
27//!    instead of duplicating documentation.
28//!
29//! 5. **Namespace Organization** : Uses the standard own/orphan/exposed/prelude namespace
30//!    pattern for controlled visibility and re-exports.
31
32#[ cfg( feature = "derive_from" ) ]
33pub use derive_tools_meta::From;
34#[ cfg( feature = "derive_inner_from" ) ]
35pub use derive_tools_meta::InnerFrom;
36#[ cfg( feature = "derive_new" ) ]
37pub use derive_tools_meta::New;
38#[ cfg( feature = "derive_not" ) ]
39pub use derive_tools_meta::Not;
40
41#[ cfg( feature = "derive_variadic_from" ) ]
42pub use derive_tools_meta::VariadicFrom;
43#[ cfg( feature = "derive_as_mut" ) ]
44pub use derive_tools_meta::AsMut;
45#[ cfg( feature = "derive_as_ref" ) ]
46pub use derive_tools_meta::AsRef;
47#[ cfg( feature = "derive_deref" ) ]
48pub use derive_tools_meta::Deref;
49#[ cfg( feature = "derive_deref_mut" ) ]
50pub use derive_tools_meta::DerefMut;
51#[ cfg( feature = "derive_index" ) ]
52pub use derive_tools_meta::Index;
53#[ cfg( feature = "derive_index_mut" ) ]
54pub use derive_tools_meta::IndexMut;
55#[ cfg( feature = "derive_more" ) ]
56#[ allow( unused_imports ) ]
57mod derive_more
58{
59  #[ cfg( feature = "derive_add" ) ]
60  pub use ::derive_more::{ Add, Sub };
61  #[ cfg( feature = "derive_add_assign" ) ]
62  pub use ::derive_more::{ AddAssign, SubAssign };
63  #[ cfg( feature = "derive_constructor" ) ]
64  pub use ::derive_more::Constructor;
65  #[ cfg( feature = "derive_error" ) ]
66  pub use ::derive_more::Error;
67  #[ cfg( feature = "derive_into" ) ]
68  pub use ::derive_more::Into;
69  // #[ cfg( feature = "derive_iterator" ) ]
70  // pub use ::derive_more ::Iterator;
71  #[ cfg( feature = "derive_into_iterator" ) ]
72  pub use ::derive_more::IntoIterator;
73  #[ cfg( feature = "derive_mul" ) ]
74  pub use ::derive_more::{ Mul, Div };
75  #[ cfg( feature = "derive_mul_assign" ) ]
76  pub use ::derive_more::{ MulAssign, DivAssign };
77  #[ cfg( feature = "derive_sum" ) ]
78  pub use ::derive_more::Sum;
79  #[ cfg( feature = "derive_try_into" ) ]
80  pub use ::derive_more::TryInto;
81  #[ cfg( feature = "derive_is_variant" ) ]
82  pub use ::derive_more::IsVariant;
83  #[ cfg( feature = "derive_unwrap" ) ]
84  pub use ::derive_more::Unwrap;
85
86}
87
88#[ doc( inline ) ]
89#[ cfg( any( feature = "derive_variadic_from", feature = "type_variadic_from" ) ) ]
90pub use variadic_from as variadic;
91
92/// Namespace with dependencies.
93#[ allow( unused_imports ) ]
94#[ cfg( feature = "enabled" ) ]
95pub mod dependency
96{
97
98  #[ doc( inline ) ]
99  pub use ::derive_tools_meta;
100
101  #[ doc( inline ) ]
102  #[ cfg( feature = "derive_clone_dyn" ) ]
103  pub use ::clone_dyn :: { self, dependency :: * };
104
105  #[ doc( inline ) ]
106  #[ cfg( any( feature = "derive_variadic_from", feature = "type_variadic_from" ) ) ]
107  pub use ::variadic_from :: { self, dependency :: * };
108
109  #[ doc( inline ) ]
110  #[ cfg( feature = "derive_more" ) ]
111  pub use ::derive_more;
112  #[ doc( inline ) ]
113  #[ cfg( feature = "derive_strum" ) ]
114  pub use ::strum;
115  #[ doc( inline ) ]
116  #[ cfg( feature = "parse_display" ) ]
117  pub use ::parse_display;
118}
119
120#[ doc( inline ) ]
121#[ cfg( feature = "enabled" ) ]
122#[ allow( unused_imports ) ]
123pub use own :: *;
124
125/// Own namespace of the module.
126#[ cfg( feature = "enabled" ) ]
127#[ allow( unused_imports ) ]
128pub mod own 
129{
130
131  use super :: *;
132  #[ doc( inline ) ]
133  pub use orphan :: *;
134  #[ cfg( feature = "derive_clone_dyn" ) ]
135  #[ doc( inline ) ]
136  pub use ::clone_dyn ::orphan :: *;
137}
138
139/// Orphan namespace of the module.
140#[ cfg( feature = "enabled" ) ]
141#[ allow( unused_imports ) ]
142pub mod orphan 
143{
144
145  use super :: *;
146  #[ doc( inline ) ]
147  pub use exposed :: *;
148}
149
150/// Exposed namespace of the module.
151#[ cfg( feature = "enabled" ) ]
152#[ allow( unused_imports ) ]
153#[ allow( ambiguous_glob_reexports ) ]
154pub mod exposed
155{
156
157  use super :: *;
158  #[ doc( inline ) ]
159  pub use prelude :: *;
160
161  #[ cfg( feature = "derive_more" ) ]
162  #[ doc( inline ) ]
163  pub use super ::derive_more :: *;
164
165  #[ cfg( feature = "derive_strum" ) ]
166  #[ doc( inline ) ]
167  pub use ::strum :: *;
168
169  #[ cfg( any( feature = "derive_variadic_from", feature = "type_variadic_from" ) ) ]
170  #[ doc( inline ) ]
171  pub use ::variadic_from ::exposed :: *;
172
173  #[ cfg( feature = "derive_variadic_from" ) ]
174  #[ doc( inline ) ]
175  pub use ::derive_tools_meta ::VariadicFrom;
176
177  #[ cfg( feature = "derive_display" ) ]
178  #[ doc( inline ) ]
179  pub use ::parse_display ::Display;
180
181  #[ cfg( feature = "derive_from_str" ) ]
182  #[ doc( inline ) ]
183  pub use ::parse_display ::FromStr;
184
185  #[ cfg( feature = "derive_clone_dyn" ) ]
186  #[ doc( inline ) ]
187  pub use ::clone_dyn ::exposed :: *;
188
189  #[ cfg( feature = "derive_clone_dyn" ) ]
190  #[ doc( inline ) ]
191  pub use ::clone_dyn;
192
193  #[ doc( inline ) ]
194  pub use ::derive_tools_meta :: *;
195
196  #[ doc( inline ) ]
197  #[ cfg( feature = "derive_from" ) ]
198  pub use ::derive_tools_meta ::From;
199
200  #[ doc( inline ) ]
201  #[ cfg( feature = "derive_inner_from" ) ]
202  pub use ::derive_tools_meta ::InnerFrom;
203
204  #[ doc( inline ) ]
205  #[ cfg( feature = "derive_new" ) ]
206  pub use ::derive_tools_meta ::New;
207}
208
209/// Prelude to use essentials: `use my_module ::prelude :: *`.
210#[ cfg( feature = "enabled" ) ]
211#[ allow( unused_imports ) ]
212pub mod prelude 
213{
214  use super :: *;
215  #[ cfg( feature = "derive_clone_dyn" ) ]
216  #[ doc( inline ) ]
217  pub use ::clone_dyn;
218
219  #[ cfg( feature = "derive_clone_dyn" ) ]
220  #[ doc( inline ) ]
221  pub use ::clone_dyn ::prelude :: *;
222
223  #[ cfg( any( feature = "derive_variadic_from", feature = "type_variadic_from" ) ) ]
224  #[ doc( inline ) ]
225  pub use ::variadic_from ::prelude :: *;
226}
227