Enum Constant Copy item path Source pub enum Constant {
Int {
value: i64 ,
bits: u8 ,
},
BigInt {
value: String ,
bits: u8 ,
},
Float {
value: f64 ,
bits: u8 ,
},
String {
value: String ,
},
Null,
Undef,
ZeroInit,
Aggregate {
elements: Vec <Constant >,
},
GlobalRef(ValueId ),
}Expand description Constant values in AIR.
Represents compile-time constant values that can appear as instruction operands.
Integer constant (signed, up to 128 bits).
Fields The integer value (stored as i64 for JSON compatibility; use String variant for larger).
Bit width (e.g., 8, 16, 32, 64, 128).
Large integer constant that doesn’t fit in i64 (stored as string).
Fields The integer value as a string.
Floating point constant.
All floats are stored as f64 regardless of source precision.
This is lossless for f32 values because every IEEE 754 binary32
value is exactly representable as a binary64 value. The bits
field records the original source precision (32 or 64) for
informational purposes, but analyses should treat the value
field as the canonical representation and should not round-trip
it back to f32.
Fields The floating point value (stored as f64; lossless for f32 sources).
Original bit width (32 for f32, 64 for f64).
Zero initializer (for aggregates).
Aggregate constant (struct, array).
Global reference (pointer to a global variable).
Used for global pointer initializers like @p = global ptr @target.
The ValueId identifies the target global’s address.
Create an integer constant.
Create a big integer constant (for values that don’t fit in i64).
Create a 32-bit integer constant.
Create a 64-bit integer constant.
Create a floating point constant.
Create a string constant.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Deserialize this value from the given Serde deserializer.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Serialize this value into the given Serde serializer.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Instruments this type with the provided [
Span], returning an
Instrumented wrapper.
Read more Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.