pub struct KindedConstant { /* private fields */ }Expand description
Kinded constant carrier — host-tier (bits, kind) payload for
Constant::Value.
Mirrors the §2.7.7/Q9 parallel-kind invariant: bits is the raw
8-byte slot payload (either an inline scalar or
Arc::into_raw::<T> for the heap-pointer variant matching kind),
and kind is the producer-side stamp. Refcount discipline goes
through the kind label via clone_with_kind / drop_with_kind
(§Q8 carrier-API bound — no per-heap-variant accessors here; the
kind label is the dispatch discriminator).
Ownership. A KindedConstant owns one strong-count share
(heap-bearing kinds) or is a pure inline scalar (no share). The
share is bumped on Clone (linker / program cloning) and released
on Drop (program teardown). Every op_push_const of the
containing Constant::Value MUST clone_with_kind before pushing,
so the constant retains its share for subsequent loads.
Surface. Constructed only by host code (test harness, embedding
layer, comptime evaluator) — the compiler never emits a
Constant::Value. The Constant enum’s #[serde(skip)] on this
variant matches the host-injected semantics; on deserialization the
Default impl reconstructs a null payload (caller must inject the
host value before execution).
Implementations§
Source§impl KindedConstant
impl KindedConstant
Sourcepub unsafe fn from_raw(bits: u64, kind: NativeKind) -> Self
pub unsafe fn from_raw(bits: u64, kind: NativeKind) -> Self
Construct from raw (bits, kind). The caller transfers
ownership of one strong-count share for heap-bearing kinds (the
Arc::into_raw::<T> share). Inline scalars pass bits directly.
§Safety
Caller must ensure bits is a valid representation of kind
per the §2.7.5 producer-side stamp (e.g. for Ptr(HeapKind::T),
bits is the result of Arc::into_raw::<TPayload> for the
matching payload type TPayload).
Sourcepub fn from_datatable(table: Arc<DataTable>) -> Self
pub fn from_datatable(table: Arc<DataTable>) -> Self
Construct a DataTable-kinded constant from an
Arc<DataTable>. The Arc share is transferred into the
constant (no additional clone); subsequent op_push_const calls
bump the refcount via clone_with_kind.
Sourcepub fn from_row_view(
schema_id: u64,
table: Arc<DataTable>,
row_idx: usize,
) -> Self
pub fn from_row_view( schema_id: u64, table: Arc<DataTable>, row_idx: usize, ) -> Self
Construct a TableView-kinded RowView constant.
Sourcepub fn from_typed_table(schema_id: u64, table: Arc<DataTable>) -> Self
pub fn from_typed_table(schema_id: u64, table: Arc<DataTable>) -> Self
Construct a TableView-kinded TypedTable constant.
Sourcepub fn kind(&self) -> NativeKind
pub fn kind(&self) -> NativeKind
The producer-side stamped kind.
Trait Implementations§
Source§impl Clone for KindedConstant
impl Clone for KindedConstant
Source§impl Debug for KindedConstant
impl Debug for KindedConstant
Source§impl Default for KindedConstant
impl Default for KindedConstant
Source§impl Drop for KindedConstant
impl Drop for KindedConstant
Auto Trait Implementations§
impl Freeze for KindedConstant
impl RefUnwindSafe for KindedConstant
impl Send for KindedConstant
impl Sync for KindedConstant
impl Unpin for KindedConstant
impl UnsafeUnpin for KindedConstant
impl UnwindSafe for KindedConstant
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more