fn try_object_like_index_get_mut<'a>(
        target: &'a Value,
        field: &str,
    ) -> Result<Option<BorrowMut<'a, Value>>, VmError> {
        let value = match &target {
            Value::Object(target) => {
                let target = target.borrow_mut()?;
                BorrowMut::try_map(target, |target| target.get_mut(field))
            }
            Value::Struct(target) => {
                let target = target.borrow_mut()?;
                BorrowMut::try_map(target, |target| target.get_mut(field))
            }
            Value::Variant(target) => {
                BorrowMut::try_map(target.borrow_mut()?, |target| match target.data_mut() {
                    VariantData::Struct(st) => st.get_mut(field),
                    _ => None,
                })
            }
            _ => return Ok(None),
        };

        let value = match value {
            Some(value) => value,
            None => {
                return Err(VmError::from(VmErrorKind::MissingField {
                    target: target.type_info()?,
                    field: field.to_owned(),
                }));
            }
        };

        Ok(Some(value))
    }
/// Implementation of getting a mutable string index on an object-like type.
Implementation of getting a mutable string index on an object-like type.
Implementation of getting a mutable string index on an object - like type .
fn try_object_like_index_get_mut<'a>(
        target: &'a Value,
        field: &str,
    ) -> Result<Option<BorrowMut<'a, Value>>, VmError> {
        let value = match &target {
            Value::Object(target) => {
                let target = target.borrow_mut()?;
                BorrowMut::try_map(target, |target| target.get_mut(field))
            }
            Value::Struct(target) => {
                let target = target.borrow_mut()?;
                BorrowMut::try_map(target, |target| target.get_mut(field))
            }
            Value::Variant(target) => {
                BorrowMut::try_map(target.borrow_mut()?, |target| match target.data_mut() {
                    VariantData::Struct(st) => st.get_mut(field),
                    _ => None,
                })
            }
            _ => return Ok(None),
        };
        let value = match value {
            Some(value) => value,
            None => {
                return Err(VmError::from(VmErrorKind::MissingField {
                    target: target.type_info()?,
                    field: field.to_owned(),
                }));
            }
        };
        Ok(Some(value))
    }
fn try_object_like_index_get_mut < ' a > ( target : & ' a Value , field : & str , ) -> Result < Option < BorrowMut < ' a , Value > > , VmError > { let value = match & target { Value :: Object ( target ) => { let target = target . borrow_mut ( ) ? ; BorrowMut :: try_map ( target , | target | target . get_mut ( field ) ) } Value :: Struct ( target ) => { let target = target . borrow_mut ( ) ? ; BorrowMut :: try_map ( target , | target | target . get_mut ( field ) ) } Value :: Variant ( target ) => { BorrowMut :: try_map ( target . borrow_mut ( ) ? , | target | match target . data_mut ( ) { VariantData :: Struct ( st ) => st . get_mut ( field ) , _ => None , } ) } _ => return Ok ( None ) , } ; let value = match value { Some ( value ) => value , None => { return Err ( VmError :: from ( VmErrorKind :: MissingField { target : target . type_info ( ) ? , field : field . to_owned ( ) , } ) ) ; } } ; Ok ( Some ( value ) ) }
Implementation of getting a mutable string index on an object-like type.
Implementation of getting a mutable string index on an object - like type .
target
&'a Value
field
&str
target
&'a Value
field
&str