Skip to main content

ConstValue

Enum ConstValue 

Source
pub enum ConstValue {
    I64(i64),
    F64(f64),
    Bool(bool),
    Byte(u8),
    Str(String),
    Void,
    Function(u16),
}
Expand description

a value the constant pool can store.

derives Debug, Clone, PartialEq. NOT EqConstValue::F64 holds f64, and f64 is not Eq (NaN != NaN). this mirrors how the AST and QalaError skip Eq for the same reason.

Variants§

§

I64(i64)

a 64-bit signed integer, the result of any i64-typed expression.

§

F64(f64)

a 64-bit IEEE 754 float. follows IEEE 754 for non-finite results (inf, -inf, NaN); the Display impl renders these explicitly so the output stays stable across Rust toolchains.

§

Bool(bool)

a boolean – the result of any bool-typed comparison, logic, or literal.

§

Byte(u8)

an 8-bit unsigned byte literal – the result of a b'X' literal or a byte-typed sub-expression. rendered in lowercase-hex form by Display.

§

Str(String)

an owned string. the constant pool holds the source-literal form; string-interpolation results live on the VM’s heap and never reach the constant pool.

§

Void

the value-shaped result of a void-typed expression (a no-trailing- value block, or the () of a void-returning function). renders as ().

§

Function(u16)

an index into the enclosing program’s chunks. resolved by codegen during call-site emission; the VM dispatches by index. width u16 matches every other indexed operand in the opcode set (so up to 65536 functions per program).

Trait Implementations§

Source§

impl Clone for ConstValue

Source§

fn clone(&self) -> ConstValue

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 Debug for ConstValue

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for ConstValue

render a ConstValue byte-deterministically.

the disassembler and the playground’s bytecode panel both read this output; identical input produces identical bytes on every machine and every Rust toolchain. non-finite floats (NaN, inf, -inf) are hand-spelled because f64’s Display of these values is platform-stable in current Rust but a deliberate spelling avoids future drift.

string values render with no escape processing: a Str containing a single quote will produce visually ambiguous output, but the rendering is still deterministic – acceptable in v1, the constant pool is in-process only this phase.

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ConstValue

Source§

fn eq(&self, other: &ConstValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ConstValue

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more