File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
embedded-io-async/src/impls Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,9 @@ impl Write for &mut [MaybeUninit<u8>] {
4343 return Err ( SliceWriteError :: Full ) ;
4444 }
4545 let ( a, b) = mem:: take ( self ) . split_at_mut ( amt) ;
46- buf. split_at ( amt)
47- . 0
48- . iter ( )
49- . enumerate ( )
50- . for_each ( |( index, byte) | {
51- a[ index] . write ( * byte) ;
52- } ) ;
46+ unsafe {
47+ core:: ptr:: copy_nonoverlapping ( buf. as_ptr ( ) , a. as_mut_ptr ( ) as * mut u8 , amt) ;
48+ }
5349 * self = b;
5450 Ok ( amt)
5551 }
Original file line number Diff line number Diff line change @@ -75,13 +75,9 @@ impl Write for &mut [MaybeUninit<u8>] {
7575 return Err ( SliceWriteError :: Full ) ;
7676 }
7777 let ( a, b) = mem:: take ( self ) . split_at_mut ( amt) ;
78- buf. split_at ( amt)
79- . 0
80- . iter ( )
81- . enumerate ( )
82- . for_each ( |( index, byte) | {
83- a[ index] . write ( * byte) ;
84- } ) ;
78+ unsafe {
79+ core:: ptr:: copy_nonoverlapping ( buf. as_ptr ( ) , a. as_mut_ptr ( ) as * mut u8 , amt) ;
80+ }
8581 * self = b;
8682 Ok ( amt)
8783 }
You can’t perform that action at this time.
0 commit comments