@@ -102,7 +102,7 @@ impl<T: UIntLike, R: RegisterLongName> Field<T, R> {
102
102
#[ inline]
103
103
/// Read value of the field as an enum member
104
104
pub fn read_as_enum < E : TryFromValue < T , EnumType = E > > ( self , val : T ) -> Option < E > {
105
- E :: try_from ( self . read ( val) )
105
+ E :: try_from_value ( self . read ( val) )
106
106
}
107
107
}
108
108
@@ -252,7 +252,7 @@ impl<T: UIntLike, R: RegisterLongName> AddAssign for FieldValue<T, R> {
252
252
pub trait TryFromValue < V > {
253
253
type EnumType ;
254
254
255
- fn try_from ( v : V ) -> Option < Self :: EnumType > ;
255
+ fn try_from_value ( v : V ) -> Option < Self :: EnumType > ;
256
256
}
257
257
258
258
/// Helper macro for computing bitmask of variable number of bits
@@ -366,7 +366,7 @@ macro_rules! register_bitmasks {
366
366
impl TryFromValue <$valtype> for Value {
367
367
type EnumType = Value ;
368
368
369
- fn try_from ( v: $valtype) -> Option <Self :: EnumType > {
369
+ fn try_from_value ( v: $valtype) -> Option <Self :: EnumType > {
370
370
match v {
371
371
$(
372
372
$( #[ $inner] ) *
@@ -417,7 +417,7 @@ macro_rules! register_bitmasks {
417
417
impl TryFromValue <$valtype> for Value {
418
418
type EnumType = Value ;
419
419
420
- fn try_from ( _v: $valtype) -> Option <Self :: EnumType > {
420
+ fn try_from_value ( _v: $valtype) -> Option <Self :: EnumType > {
421
421
Option :: None
422
422
}
423
423
}
@@ -470,14 +470,14 @@ mod tests {
470
470
impl crate :: fields:: TryFromValue < u16 > for Foo {
471
471
type EnumType = Foo ;
472
472
473
- fn try_from ( v : u16 ) -> Option < Self :: EnumType > {
474
- Self :: try_from ( v as u32 )
473
+ fn try_from_value ( v : u16 ) -> Option < Self :: EnumType > {
474
+ Self :: try_from_value ( v as u32 )
475
475
}
476
476
}
477
477
impl crate :: fields:: TryFromValue < u32 > for Foo {
478
478
type EnumType = Foo ;
479
479
480
- fn try_from ( v : u32 ) -> Option < Self :: EnumType > {
480
+ fn try_from_value ( v : u32 ) -> Option < Self :: EnumType > {
481
481
match v {
482
482
0 => Some ( Foo :: Foo0 ) ,
483
483
1 => Some ( Foo :: Foo1 ) ,
@@ -556,7 +556,7 @@ mod tests {
556
556
for shift in 0 ..29 {
557
557
let field = Field :: < u32 , ( ) > :: new ( 0x7 , shift) ;
558
558
for x in 0 ..8 {
559
- assert_eq ! ( field. read_as_enum( x << shift) , Foo :: try_from ( x) ) ;
559
+ assert_eq ! ( field. read_as_enum( x << shift) , Foo :: try_from_value ( x) ) ;
560
560
}
561
561
}
562
562
}
0 commit comments