Function const_named_struct

Source
pub fn const_named_struct(
    struct_type: &TypeRef,
    constant_vals: &[ValueRef],
) -> ValueRef
Expand description

Create a non-anonymous ConstantStruct from values.

§Details

Creates a constant named struct value with specified field values.

This function wraps the LLVMConstNamedStruct function from the LLVM core library. It generates a constant struct value of the specified named struct type (struct_type) using an array of constant values (constant_vals). Each element in constant_vals corresponds to a field in the struct.

§Parameters

  • struct_type: A reference to the named struct type (TypeRef) for the constant value. This type specifies the structure that the constant will represent.
  • constant_vals: A slice of constant values (&[ValueRef]) that will be used as the fields of the struct. Each element in this slice corresponds to a field in the struct.

§Returns

Returns an instance of ValueRef, which encapsulates the constant named struct value created with the specified fields.