File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 3939 }
4040}
4141
42+ #[ cfg( feature = "unproven" ) ]
43+ #[ allow( deprecated) ]
44+ impl < T > v2:: toggleable:: Default for T where T : v1:: toggleable:: Default { }
4245
4346/// Implementation of fallible `v2::InputPin` for `v1::InputPin` digital traits
4447#[ cfg( feature = "unproven" ) ]
@@ -81,6 +84,20 @@ mod tests {
8184 }
8285 }
8386
87+ #[ allow( deprecated) ]
88+ impl v1:: StatefulOutputPin for OldOutputPinImpl {
89+ fn is_set_low ( & self ) -> bool {
90+ self . state == false
91+ }
92+
93+ fn is_set_high ( & self ) -> bool {
94+ self . state == true
95+ }
96+ }
97+
98+ #[ allow( deprecated) ]
99+ impl v1:: toggleable:: Default for OldOutputPinImpl { }
100+
84101 struct NewOutputPinConsumer < T : v2:: OutputPin > {
85102 _pin : T ,
86103 }
@@ -92,6 +109,25 @@ mod tests {
92109 }
93110 }
94111
112+ struct NewToggleablePinConsumer < T : v2:: ToggleableOutputPin > {
113+ _pin : T ,
114+ }
115+
116+ impl < T > NewToggleablePinConsumer < T >
117+ where
118+ T : v2:: ToggleableOutputPin ,
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+
95131 #[ test]
96132 fn v2_v1_output_implicit ( ) {
97133 let i = OldOutputPinImpl { state : false } ;
You can’t perform that action at this time.
0 commit comments