@@ -13,11 +13,18 @@ bagel = "0.1"
1313
1414## What bagel can do
1515
16- - ` Ctor ` : Derive constructors
17- - ` Gtor ` : Derive getters
18- - ` Stor ` : Derive setters
19- - ` Constdef ` : Derive constant, compile-time default implementations
2016- ` def ` : Use the [ default declaration syntax] ( #default-declaration-syntax )
17+ - ` Ctor ` : Derive constructors:
18+ - Full lifetimes, generics and where clause support
19+ - ` #[phantom] ` : Auto elide ` PhantomData ` fields
20+ - ` #[ctor_const] ` : Make the constructor a ` const fn `
21+ - ` Gtor ` : Derive getters:
22+ - Full lifetimes, generics and where clause support
23+ - Advanced attributes: ` #[gtor_const] ` , ` #[gtor_copy] ` , ` #[gtor_skip] ` , ` #[phantom] ` and ` #[gtor] `
24+ - ` Stor ` : Derive setters
25+ - Full lifetimes, generics and where clause support
26+ - Skip setter with ` #[stor_skip] ` or ` #[phantom] `
27+ - ` Constdef ` : Derive constant, compile-time default implementations. See [ an example here] ( #constdef-example )
2128
2229## Default declaration syntax
2330
@@ -65,6 +72,29 @@ assert_eq!(myoven.items_to_bake[3], "pie");
6572assert_eq! (myoven . people_buffer. len (), 2 );
6673```
6774
75+ ## ` Constdef ` example
76+
77+ ``` rust
78+ use bagel :: Constdef ;
79+
80+ #[derive(Constdef )]
81+ struct Port {
82+ requests : usize ,
83+ admin : bool ,
84+ }
85+
86+ #[derive(Constdef )]
87+ struct PortLogger {
88+ ports : [Port ; 65536 ],
89+ root_pid : usize ,
90+ }
91+
92+ const PORT_LOGGER : PortLogger = PortLogger :: default ();
93+
94+ assert_eq! (PORT_LOGGER . ports[0 ]. requests, 0 );
95+ assert_eq! (PORT_LOGGER . ports[65535 ]. admin, false );
96+ ```
97+
6898## License
6999
70100The ` dough ` and ` bagel ` libraries are distributed under the [ Apache-2.0 License] ( ./LICENSE ) .
0 commit comments