Skip to main content

VecPayload

Struct VecPayload 

Source
#[repr(C)]
pub struct VecPayload { pub element_descriptor: *const TypeDescriptor, pub items: ReprCVec<GcRef>, }
Expand description

The Vec[T] payload: the element descriptor plus the growable items.

items grows in place (§11.1) and is Drop, so VEC’s drop_value releases its buffer on sweep (§12.5). The element descriptor is a 'static borrow and owns nothing.

Fields§

§element_descriptor: *const TypeDescriptor

The descriptor for every element in items, or null when this vector has not been told its element type. Read by trace/format/equals to dispatch without a scattered type switch (§11.4); read it through VecPayload::element, not directly.

Null is the honest encoding of “unknown”, and it only survives while the vector is empty: the first push adopts the pushed value’s descriptor. A vector that has been told its element type is never retagged.

§items: ReprCVec<GcRef>

The elements, in order. Growable (not Box<[T]>) so push mutates in place, and a ReprCVec rather than a std::Vec so the length and the element pointer are at offsets generated code is allowed to know (ADR-118). std::Vec is #[repr(Rust)] and hides both inside a private RawVec.

Implementations§

Source§

impl VecPayload

Source

pub fn element(&self) -> Option<&'static TypeDescriptor>

The element descriptor, or None if this vector was never told its element type. None implies items is empty.

[ElementSeq::element] is the body; this forwarder is the public spelling, and it exists because [ElementSeq] is pub(crate) while one caller is not: praxis-codegen-cranelift’s adversarial audit reads an empty Vec[Float]’s descriptor through this method, which is the check that codegen labelled the vector before any push could repair it.

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> 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, 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.