pub fn stack_unpack_struct(
    state: &AbstractState,
    struct_index: StructDefinitionIndex,
) -> Result<AbstractState, VMError> {
    let state_copy = state.clone();
    let mut state = state.clone();
    let struct_def = state_copy.module.struct_def_at(struct_index);
    let struct_def_view = StructDefinitionView::new(&state_copy.module, struct_def);
    let token_views = struct_def_view
        .fields()
        .into_iter()
        .flatten()
        .map(|field| field.type_signature().token());
    for token_view in token_views {
        let abstract_value = AbstractValue {
            token: token_view.as_inner().clone(),
            kind: token_view.kind(&[]),
        };
        state = stack_push(&state, abstract_value)?;
    }
    Ok(state)
}
/// Push the fields of a struct as `AbstractValue`s to the stack
Push the fields of a struct as `AbstractValue`s to the stack
Push the fields of a struct as ` AbstractValue ` s to the stack
pub fn stack_unpack_struct(
    state: &AbstractState,
    struct_index: StructDefinitionIndex,
) -> Result<AbstractState, VMError> {
    let state_copy = state.clone();
    let mut state = state.clone();
    let struct_def = state_copy.module.struct_def_at(struct_index);
    let struct_def_view = StructDefinitionView::new(&state_copy.module, struct_def);
    let token_views = struct_def_view
        .fields()
        .into_iter()
        .flatten()
        .map(|field| field.type_signature().token());
    for token_view in token_views {
        let abstract_value = AbstractValue {
            token: token_view.as_inner().clone(),
            kind: token_view.kind(&[]),
        };
        state = stack_push(&state, abstract_value)?;
    }
    Ok(state)
}
pub fn stack_unpack_struct ( state : & AbstractState , struct_index : StructDefinitionIndex , ) -> Result < AbstractState , VMError > { let state_copy = state . clone ( ) ; let mut state = state . clone ( ) ; let struct_def = state_copy . module . struct_def_at ( struct_index ) ; let struct_def_view = StructDefinitionView :: new ( & state_copy . module , struct_def ) ; let token_views = struct_def_view . fields ( ) . into_iter ( ) . flatten ( ) . map ( | field | field . type_signature ( ) . token ( ) ) ; for token_view in token_views { let abstract_value = AbstractValue { token : token_view . as_inner ( ) . clone ( ) , kind : token_view . kind ( & [ ] ) , } ; state = stack_push ( & state , abstract_value ) ? ; } Ok ( state ) }
Push the fields of a struct as `AbstractValue`s to the stack
Push the fields of a struct as ` AbstractValue ` s to the stack
state
&AbstractState
struct_index
StructDefinitionIndex