@@ -6,6 +6,7 @@ use bevy_math::{
66} ;
77use bevy_reflect:: Reflect ;
88use derive_more:: derive:: { Display , Error , From } ;
9+ use either:: Either ;
910
1011/// A keyframe-defined curve that "interpolates" by stepping at `t = 1.0` to the next keyframe.
1112#[ derive( Debug , Clone , Reflect ) ]
@@ -189,11 +190,11 @@ where
189190 match self . core . sample_interp ( t) {
190191 InterpolationDatum :: Exact ( v)
191192 | InterpolationDatum :: LeftTail ( v)
192- | InterpolationDatum :: RightTail ( v) => TwoIterators :: Left ( v. iter ( ) . copied ( ) ) ,
193+ | InterpolationDatum :: RightTail ( v) => Either :: Left ( v. iter ( ) . copied ( ) ) ,
193194
194195 InterpolationDatum :: Between ( u, v, s) => {
195196 let interpolated = u. iter ( ) . zip ( v. iter ( ) ) . map ( move |( x, y) | x. lerp ( * y, s) ) ;
196- TwoIterators :: Right ( interpolated)
197+ Either :: Right ( interpolated)
197198 }
198199 }
199200 }
@@ -243,14 +244,14 @@ where
243244 match self . core . sample_interp ( t) {
244245 InterpolationDatum :: Exact ( v)
245246 | InterpolationDatum :: LeftTail ( v)
246- | InterpolationDatum :: RightTail ( v) => TwoIterators :: Left ( v. iter ( ) . cloned ( ) ) ,
247+ | InterpolationDatum :: RightTail ( v) => Either :: Left ( v. iter ( ) . cloned ( ) ) ,
247248
248249 InterpolationDatum :: Between ( u, v, s) => {
249250 let interpolated =
250251 u. iter ( )
251252 . zip ( v. iter ( ) )
252253 . map ( move |( x, y) | if s >= 1.0 { y. clone ( ) } else { x. clone ( ) } ) ;
253- TwoIterators :: Right ( interpolated)
254+ Either :: Right ( interpolated)
254255 }
255256 }
256257 }
@@ -302,10 +303,10 @@ where
302303 // Pick out the part of this that actually represents the position (instead of tangents),
303304 // which is the middle third.
304305 let width = self . core . width ( ) ;
305- TwoIterators :: Left ( v[ width..( width * 2 ) ] . iter ( ) . copied ( ) )
306+ Either :: Left ( v[ width..( width * 2 ) ] . iter ( ) . copied ( ) )
306307 }
307308
308- InterpolationDatum :: Between ( ( t0, u) , ( t1, v) , s) => TwoIterators :: Right (
309+ InterpolationDatum :: Between ( ( t0, u) , ( t1, v) , s) => Either :: Right (
309310 cubic_spline_interpolate_slices ( self . core . width ( ) / 3 , u, v, s, t1 - t0) ,
310311 ) ,
311312 }
@@ -392,26 +393,6 @@ pub enum WeightsCurve {
392393// HELPERS //
393394//---------//
394395
395- enum TwoIterators < A , B > {
396- Left ( A ) ,
397- Right ( B ) ,
398- }
399-
400- impl < A , B , T > Iterator for TwoIterators < A , B >
401- where
402- A : Iterator < Item = T > ,
403- B : Iterator < Item = T > ,
404- {
405- type Item = T ;
406-
407- fn next ( & mut self ) -> Option < Self :: Item > {
408- match self {
409- TwoIterators :: Left ( a) => a. next ( ) ,
410- TwoIterators :: Right ( b) => b. next ( ) ,
411- }
412- }
413- }
414-
415396/// Helper function for cubic spline interpolation.
416397fn cubic_spline_interpolation < T > (
417398 value_start : T ,
0 commit comments