File tree Expand file tree Collapse file tree 5 files changed +33
-5
lines changed
Expand file tree Collapse file tree 5 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 1+ # Changelog
2+
3+ All changes to this project will be noted in this file.
4+
5+ ## Version 0.1.1
6+
7+ ### Fixes
8+
9+ - Allow field attributes in ` def! ` macro
10+ - Added examples to repo
11+ - Fixed docs
12+
13+ ## Version 0.1.0
14+
15+ Initial release
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ license = "Apache-2.0"
77name = " bagel"
88readme = " ../README.md"
99repository = " https://github.com/skytable/bagel"
10- version = " 0.1.0 "
10+ version = " 0.1.1 "
1111
1212[dependencies ]
1313dough = " 0.1.1"
Original file line number Diff line number Diff line change 99//! - [`Ctor`]: Derive constructors
1010//! - [`Gtor`]: Derive getters
1111//! - [`Stor`]: Derive setters
12- //! - [`def`]: Use the [default declaration syntax](https://github.com/skytable/bagel/README.md #default-declaration-syntax)
12+ //! - [`def`]: Use the [default declaration syntax](https://github.com/skytable/bagel#default-declaration-syntax)
1313//!
1414
1515#[ macro_use]
Original file line number Diff line number Diff line change 11#[ macro_export]
2- /// The [`def`] macro enables you to use the [default declaration syntax](https://github.com/skytable/bagel/README.md #default-declaration-syntax).
2+ /// The [`def`] macro enables you to use the [default declaration syntax](https://github.com/skytable/bagel#default-declaration-syntax).
33///
44/// ## Example
55/// ```
3333macro_rules! def {
3434 (
3535 $( #[ $meta: meta] ) *
36- $vis: vis struct $ident: ident { $( $field: ident: $ty: ty $( = $expr: expr) ?) ,* $( , ) ?}
36+ $vis: vis struct $ident: ident { $( $( # [ $fieldmeta : meta ] ) * $ field: ident: $ty: ty $( = $expr: expr) ?) ,* $( , ) ?}
3737 ) => {
3838 $( #[ $meta] ) *
3939 $vis struct $ident { $( $field: $ty, ) * }
4040 impl :: core:: default :: Default for $ident {
41- fn default ( ) -> Self { Self { $( $field: $crate:: process_defexpr!( $( $expr) ?) , ) * } }
41+ fn default ( ) -> Self { Self { $( $( # [ $fieldmeta ] ) * $ field: $crate:: process_defexpr!( $( $expr) ?) , ) * } }
4242 }
4343 } ;
4444}
Original file line number Diff line number Diff line change 1+ use bagel:: Gtor ;
2+
3+ bagel:: def! {
4+ #[ derive( Gtor ) ]
5+ struct Hello {
6+ #[ gtor_copy]
7+ a: u8 = 10 ,
8+ }
9+ }
10+
11+ fn main ( ) {
12+ assert_eq ! ( Hello :: default ( ) . get_a( ) , 10 ) ;
13+ }
You can’t perform that action at this time.
0 commit comments