File tree Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
28
28
29
29
### Changed
30
30
31
+ - [ breaking-change] remove ` Variant<U, ENUM_A> ` , use ` Option<ENUM_A> ` instead
32
+
31
33
- split out register size type (` RawType ` ) from ` ResetValue ` trait
32
34
33
35
- ` anyhow ` crate is used for error handling
Original file line number Diff line number Diff line change @@ -223,15 +223,6 @@ impl<REG: RegisterSpec> W<REG> {
223
223
}
224
224
}
225
225
226
- /// Used if enumerated values cover not the whole range.
227
- #[ derive( Clone , Copy , PartialEq ) ]
228
- pub enum Variant < U , T > {
229
- /// Expected variant.
230
- Val ( T ) ,
231
- /// Raw bits.
232
- Res ( U ) ,
233
- }
234
-
235
226
/// Field reader.
236
227
///
237
228
/// Result of the `read` methods of fields.
Original file line number Diff line number Diff line change @@ -451,7 +451,7 @@ pub fn fields(
451
451
let pc = & v. pc ;
452
452
453
453
if has_reserved_variant {
454
- quote ! { #i => Val ( #name_pc_a:: #pc) , }
454
+ quote ! { #i => Some ( #name_pc_a:: #pc) , }
455
455
} else {
456
456
quote ! { #i => #name_pc_a:: #pc, }
457
457
}
@@ -461,7 +461,7 @@ pub fn fields(
461
461
462
462
if has_reserved_variant {
463
463
arms. extend ( quote ! {
464
- i => Res ( i ) ,
464
+ _ => None ,
465
465
} ) ;
466
466
} else if 1 << width. to_ty_width ( ) ? != variants. len ( ) {
467
467
arms. extend ( quote ! {
@@ -473,8 +473,7 @@ pub fn fields(
473
473
enum_items. extend ( quote ! {
474
474
///Get enumerated values variant
475
475
#inline
476
- pub fn variant( & self ) -> crate :: Variant <#fty, #name_pc_a> {
477
- use crate :: Variant :: * ;
476
+ pub fn variant( & self ) -> Option <#name_pc_a> {
478
477
match self . bits {
479
478
#arms
480
479
}
You can’t perform that action at this time.
0 commit comments