File tree Expand file tree Collapse file tree 2 files changed +19
-19
lines changed
Expand file tree Collapse file tree 2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -45,31 +45,31 @@ fn color_from_bytes() {
4545 ) ;
4646}
4747
48- impl Into < [ u8 ; 4 ] > for Color {
49- fn into ( self ) -> [ u8 ; 4 ] {
48+ impl From < Color > for [ u8 ; 4 ] {
49+ fn from ( val : Color ) -> Self {
5050 [
51- ( self . r * 255. ) as u8 ,
52- ( self . g * 255. ) as u8 ,
53- ( self . b * 255. ) as u8 ,
54- ( self . a * 255. ) as u8 ,
51+ ( val . r * 255. ) as u8 ,
52+ ( val . g * 255. ) as u8 ,
53+ ( val . b * 255. ) as u8 ,
54+ ( val . a * 255. ) as u8 ,
5555 ]
5656 }
5757}
5858
59- impl Into < Color > for [ u8 ; 4 ] {
60- fn into ( self ) -> Color {
59+ impl From < [ u8 ; 4 ] > for Color {
60+ fn from ( val : [ u8 ; 4 ] ) -> Self {
6161 Color :: new (
62- self [ 0 ] as f32 / 255. ,
63- self [ 1 ] as f32 / 255. ,
64- self [ 2 ] as f32 / 255. ,
65- self [ 3 ] as f32 / 255. ,
62+ val [ 0 ] as f32 / 255. ,
63+ val [ 1 ] as f32 / 255. ,
64+ val [ 2 ] as f32 / 255. ,
65+ val [ 3 ] as f32 / 255. ,
6666 )
6767 }
6868}
6969
70- impl Into < [ f32 ; 4 ] > for Color {
71- fn into ( self ) -> [ f32 ; 4 ] {
72- [ self . r , self . g , self . b , self . a ]
70+ impl From < Color > for [ f32 ; 4 ] {
71+ fn from ( val : Color ) -> Self {
72+ [ val . r , val . g , val . b , val . a ]
7373 }
7474}
7575
Original file line number Diff line number Diff line change @@ -61,12 +61,12 @@ impl Camera {
6161 }
6262}
6363
64- impl Into < Camera2D > for & Camera {
65- fn into ( self ) -> Camera2D {
64+ impl From < & Camera > for Camera2D {
65+ fn from ( val : & Camera ) -> Self {
6666 let aspect = screen_width ( ) / screen_height ( ) ;
6767 Camera2D {
68- zoom : vec2 ( self . scale , -self . scale * aspect) ,
69- offset : vec2 ( self . offset . x , -self . offset . y ) ,
68+ zoom : vec2 ( val . scale , -val . scale * aspect) ,
69+ offset : vec2 ( val . offset . x , -val . offset . y ) ,
7070 target : vec2 ( 0. , 0. ) ,
7171 rotation : 0. ,
7272
You can’t perform that action at this time.
0 commit comments