pub fn insert(
        &mut self,
        val: Value,
        element: Value,
        idx: usize,
        location: Option<Location>,
    ) -> Value {
        assert_eq!(
            val.get_type(self.context).get_element(self.context, idx),
            element.get_type(self.context)
        );
        self.make_value(Instruction::Insert(val, element, idx, location))
    }
/// Insert an element into a vector or struct type.
///
/// # Examples
///
/// ```
/// # use yair::*;
/// # let mut context = Context::new();
/// # let module = context.create_module().build();
/// # let u32_ty = context.get_uint_type(32);
/// # let vec_ty = context.get_vector_type(u32_ty, 4);
/// # let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", vec_ty).with_arg("b", u32_ty).build();
/// # let block = function.create_block(&mut context).build();
/// # let val = function.get_arg(&context, 0);
/// # let element = function.get_arg(&context, 1);
/// # let mut instruction_builder = block.create_instructions(&mut context);
/// # let location = None;
/// let insert = instruction_builder.insert(val, element, 1, location);
/// ```
Insert an element into a vector or struct type.
Insert an element into a vector or struct type .
pub fn insert(
        &mut self,
        val: Value,
        element: Value,
        idx: usize,
        location: Option<Location>,
    ) -> Value {
        assert_eq!(
            val.get_type(self.context).get_element(self.context, idx),
            element.get_type(self.context)
        );
        self.make_value(Instruction::Insert(val, element, idx, location))
    }
pub fn insert ( & mut self , val : Value , element : Value , idx : usize , location : Option < Location > , ) -> Value { assert_eq ! ( val get_type ( self context ) get_element ( self context idx ) element get_type ( self context ) ) ; self . make_value ( Instruction :: Insert ( val , element , idx , location ) ) }
Insert an element into a vector or struct type.
Insert an element into a vector or struct type .
&mut self
val
Value
element
Value
idx
usize
location
Option<Location>
&mut self
val
Value
element
Value
idx
usize
location
Option<Location>
examples
None
use yair::*;
None
let mut context = context::new();
None
let module = context.create_module().build();
None
let u32_ty = context.get_uint_type(32);
None
let vec_ty = context.get_vector_type(u32_ty, 4);
None
let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", vec_ty).with_arg("b", u32_ty).build();
None
let block = function.create_block(&mut context).build();
None
let val = function.get_arg(&context, 0);
None
let element = function.get_arg(&context, 1);
None
let mut instruction_builder = block.create_instructions(&mut context);
None
let location = none;
let insert = instruction_builder.insert(val, element, 1, location);
```
let insert = instruction_builder . insert ( val element 1 location ) ; ` ` `