pub fn borrow_ref_vector_element(
        self,
        elem_num: usize,
        is_mut: bool,
        local_idx: TempIndex,
    ) -> Option<TypedValue> {
        if cfg!(debug_assertions) {
            let (self_is_mut, _) = self.ty.get_ref_type();
            assert!(self_is_mut || !is_mut);
        }
        let elem_ty = self.ty.into_ref_vector_elem(None);
        let val = match self.val {
            BaseValue::Vector(mut v) => {
                if elem_num >= v.len() {
                    return None;
                }
                v.remove(elem_num)
            }
            _ => unreachable!(),
        };
        Some(TypedValue {
            ty: Type::Reference(is_mut, elem_ty),
            val,
            ptr: Pointer::RefElement(local_idx, elem_num),
        })
    }
/// Borrow an element from a vector at the given index. Return None of index out-of-bounds.
Borrow an element from a vector at the given index. Return None of index out-of-bounds.
Borrow an element from a vector at the given index . Return None of index out - of - bounds .
pub fn borrow_ref_vector_element(
        self,
        elem_num: usize,
        is_mut: bool,
        local_idx: TempIndex,
    ) -> Option<TypedValue> {
        if cfg!(debug_assertions) {
            let (self_is_mut, _) = self.ty.get_ref_type();
            assert!(self_is_mut || !is_mut);
        }
        let elem_ty = self.ty.into_ref_vector_elem(None);
        let val = match self.val {
            BaseValue::Vector(mut v) => {
                if elem_num >= v.len() {
                    return None;
                }
                v.remove(elem_num)
            }
            _ => unreachable!(),
        };
        Some(TypedValue {
            ty: Type::Reference(is_mut, elem_ty),
            val,
            ptr: Pointer::RefElement(local_idx, elem_num),
        })
    }
pub fn borrow_ref_vector_element ( self , elem_num : usize , is_mut : bool , local_idx : TempIndex , ) -> Option < TypedValue > { if cfg ! ( debug_assertions ) { let ( self_is_mut , _ ) = self . ty . get_ref_type ( ) ; assert ! ( self_is_mut is_mut ) ; } let elem_ty = self . ty . into_ref_vector_elem ( None ) ; let val = match self . val { BaseValue :: Vector ( mut v ) => { if elem_num >= v . len ( ) { return None ; } v . remove ( elem_num ) } _ => unreachable ! ( ) , } ; Some ( TypedValue { ty : Type :: Reference ( is_mut , elem_ty ) , val , ptr : Pointer :: RefElement ( local_idx , elem_num ) , } ) }
Borrow an element from a vector at the given index.
Borrow an element from a vector at the given index .
self
elem_num
usize
is_mut
bool
local_idx
TempIndex