Function const_array2

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

Create a ConstantArray from values.

§Details

Creates a constant array value with elements of a specified type.

This function wraps the LLVMConstArray2 function from the LLVM core library. It generates a constant array value with the specified element type (element_type) using an array of constant values (constant_vals). Each element in constant_vals must be of the same type as element_type.

§Parameters

  • element_type: A reference to the type of elements in the array (TypeRef). This specifies the type that each element in the array should have.
  • constant_vals: A slice of constant values (&[ValueRef]) that will be used as the elements of the array. Each element in this slice corresponds to an element in the resulting array.

§Returns

Returns an instance of ValueRef, which encapsulates the constant array value created with the specified element type and elements.