Skip to main content

InlineSliceSite

Struct InlineSliceSite 

Source
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

Source

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.

Source

pub const fn elements_offset(self) -> usize

Object base → the element buffer pointer.

Source

pub const fn len_offset(self) -> usize

Object base → the element count.

Source

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

Source§

fn clone(&self) -> InlineSliceSite

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InlineSliceSite

Source§

impl Debug for InlineSliceSite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.