pub struct InlineSliceSite { /* private fields */ }Expand description
Everything generated code needs to walk one collection payload’s pinned
ReprCVec inline, as one value with private fields (ADR-118 part 2).
This is InlineInternSite’s shape and it is here
for the same reason. The sequence needs a descriptor to prove and three
displacements, and handed over as loose constants they are four independent
chances to pair one payload’s offsets with another’s descriptor — which is
not a hypothetical: VecPayload and GridPayload are both a Vec<GcRef>
behind a leading word, at different displacements, and a Grid proved as
a Vec would read its width as an element pointer. So they are one value,
its fields are private, its constructor is pub(crate), and each instance is
minted in the module that owns the payload whose layout it describes.
The backend cannot assemble one; it can only name one this crate wrote.
The displacements are from the object’s base, not from its payload:
generated code holds a GcRef and the header size is GcHeader’s business
(ADR-039 decision 1), so the addition happens once, here, rather than at
three emit sites.
Implementations§
Source§impl InlineSliceSite
impl InlineSliceSite
Sourcepub const fn type_id(self) -> BuiltinTypeId
pub const fn type_id(self) -> BuiltinTypeId
The built-in whose descriptor an object must carry before any of the displacements below may be read. The proof is ADR-102’s, and it is what makes the folded offsets the offsets the allocator actually used.
Sourcepub const fn elements_offset(self) -> usize
pub const fn elements_offset(self) -> usize
Object base → the element buffer pointer.
Sourcepub const fn len_offset(self) -> usize
pub const fn len_offset(self) -> usize
Object base → the element count.
Sourcepub const fn element_shift(self) -> u8
pub const fn element_shift(self) -> u8
log2(element_size): the shift that turns an index into a byte offset.
Trait Implementations§
Source§impl Clone for InlineSliceSite
impl Clone for InlineSliceSite
Source§fn clone(&self) -> InlineSliceSite
fn clone(&self) -> InlineSliceSite
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more