Skip to content

Commit

Permalink
use raw pointer copy
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanderc committed May 2, 2024
1 parent 74e25df commit cab1ab1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion heed/src/reserved_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl io::Write for ReservedSpace<'_> {
unsafe {
// SAFETY: we can always cast `T` -> `MaybeUninit<T>` as it's a transparent wrapper
let buf_uninit = std::slice::from_raw_parts(buf.as_ptr().cast(), buf.len());
remaining.get_unchecked_mut(..buf.len()).copy_from_slice(buf_uninit);
remaining.as_mut_ptr().copy_from_nonoverlapping(buf_uninit.as_ptr(), buf.len());
}

self.write_head += buf.len();
Expand Down

0 comments on commit cab1ab1

Please sign in to comment.