Function presser::copy_to_offset_with_align
source · pub fn copy_to_offset_with_align<T: Copy, S: Slab + ?Sized>(
src: &T,
dst: &mut S,
start_offset: usize,
min_alignment: usize
) -> Result<CopyRecord, Error>
Expand description
Copies src
into the memory represented by dst
starting at a minimum location
of start_offset
bytes past the start of dst
and with minimum alignment
min_alignment
.
start_offset
is the offset into the allocation represented bydst
, in bytes, before which any copied data will certainly not be placed. However, the actual beginning of the copied data may not be exactly atstart_offset
if padding bytes are needed to satisfy alignment requirements. The actual beginning of the copied bytes is contained in the returnedCopyRecord
.min_alignment
is the minimum alignment to which the copy will be aligned. The copy may not actually be aligned tomin_alignment
depending on the alignment requirements ofT
(the actual alignment will be the greater betweenalign_of::<T>
andmin_align.next_power_of_two()
).
Safety
This function is safe on its own, however it is very possible to do unsafe things if you read the copied data in the wrong way. See the crate-level Safety documentation for more.