File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 39
39
}
40
40
}
41
41
42
+ #[ cfg( feature = "unproven" ) ]
43
+ #[ allow( deprecated) ]
44
+ impl < T > v2:: toggleable:: Default for T where T : v1:: toggleable:: Default { }
42
45
43
46
/// Implementation of fallible `v2::InputPin` for `v1::InputPin` digital traits
44
47
#[ cfg( feature = "unproven" ) ]
@@ -81,6 +84,20 @@ mod tests {
81
84
}
82
85
}
83
86
87
+ #[ allow( deprecated) ]
88
+ impl v1:: StatefulOutputPin for OldOutputPinImpl {
89
+ fn is_set_low ( & mut self ) -> bool {
90
+ self . state == false
91
+ }
92
+
93
+ fn is_set_high ( & mut self ) -> bool {
94
+ self . state == true
95
+ }
96
+ }
97
+
98
+ #[ allow( deprecated) ]
99
+ impl v1:: toggleable:: Default for OldOutputPinImpl { }
100
+
84
101
struct NewOutputPinConsumer < T : v2:: OutputPin > {
85
102
_pin : T ,
86
103
}
@@ -92,6 +109,25 @@ mod tests {
92
109
}
93
110
}
94
111
112
+ struct NewToggleablePinConsumer < T : v2:: ToggleableOutputPin > {
113
+ _pin : T ,
114
+ }
115
+
116
+ impl < T > NewToggleablePinConsumer < T >
117
+ where
118
+ T : v2:: OutputPin ,
119
+ {
120
+ pub fn new ( pin : T ) -> NewToggleablePinConsumer < T > {
121
+ NewToggleablePinConsumer { _pin : pin }
122
+ }
123
+ }
124
+
125
+ #[ test]
126
+ fn v2_v1_toggleable_implicit ( ) {
127
+ let i = OldOutputPinImpl { state : false } ;
128
+ let _c = NewToggleablePinConsumer :: new ( i) ;
129
+ }
130
+
95
131
#[ test]
96
132
fn v2_v1_output_implicit ( ) {
97
133
let i = OldOutputPinImpl { state : false } ;
You can’t perform that action at this time.
0 commit comments