File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ pub fn expand_bitmap(input: BitmapInput) -> syn::Result<TokenStream2> {
4545 }
4646
4747 #[ inline]
48- pub fn #setter_name( & mut self , value: #storage_ty ) -> & mut Self {
49- assert!( value <= #mask as #storage_ty ) ;
48+ pub fn #setter_name( & mut self , value: #this_storage_ty ) -> & mut Self {
49+ assert!( value <= #mask as #this_storage_ty ) ;
5050 self . 0 = ( ( self . 0 & !( ( #mask) << #bit_index) ) | ( ( ( value as #storage_ty) & #mask) << #bit_index) ) ;
5151 self
5252 }
@@ -69,9 +69,19 @@ pub fn expand_bitmap(input: BitmapInput) -> syn::Result<TokenStream2> {
6969 pub struct #name( #storage_ty) ;
7070
7171 impl #name {
72+ fn new( value: #storage_ty) -> Self {
73+ Self ( value)
74+ }
75+
7276 #( #accessors) *
7377 }
7478
79+ impl Default for #name {
80+ fn default ( ) -> Self {
81+ Self ( 0 )
82+ }
83+ }
84+
7585 impl :: core:: convert:: From <#name> for #storage_ty {
7686 fn from( value: #name) -> Self {
7787 value. 0
You can’t perform that action at this time.
0 commit comments