pub struct GcArrayLayout {
pub base_size: u32,
pub align: u32,
pub elem_size: u32,
}
Expand description
The layout of a GC-managed array.
This layout is only valid for use with the GC runtime that created it. It is not valid to use one GC runtime’s layout with another GC runtime, doing so is memory safe but will lead to general incorrectness like panics and wrong results.
All offsets are from the start of the object; that is, the size of the GC header (for example) is included in the offset.
All arrays are composed of the generic VMGcHeader
, followed by
collector-specific fields, followed by the contiguous array elements
themselves. The array elements must be aligned to the element type’s natural
alignment.
Fields§
§base_size: u32
The size of this array object, without any elements.
The array’s elements, if any, must begin at exactly this offset.
align: u32
The alignment of this array.
elem_size: u32
The size and natural alignment of each element in this array.
Implementations§
Source§impl GcArrayLayout
impl GcArrayLayout
Sourcepub fn size_for_len(&self, len: u32) -> u32
pub fn size_for_len(&self, len: u32) -> u32
Get the total size of this array for a given length of elements.
Sourcepub fn elem_offset(&self, i: u32) -> u32
pub fn elem_offset(&self, i: u32) -> u32
Get the offset of the i
th element in an array with this layout.
Trait Implementations§
Source§impl Clone for GcArrayLayout
impl Clone for GcArrayLayout
Source§fn clone(&self) -> GcArrayLayout
fn clone(&self) -> GcArrayLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more