pub async fn async_resume(&mut self) -> Result<GeneratorState, VmError> {
        loop {
            let len = self.vms.len();
            let vm = self.vm_mut()?;

            match Self::run(vm)? {
                VmHalt::Exited => (),
                VmHalt::Awaited(awaited) => {
                    awaited.into_vm(vm).await?;
                    continue;
                }
                VmHalt::VmCall(vm_call) => {
                    vm_call.into_execution(self)?;
                    continue;
                }
                VmHalt::Yielded => return Ok(GeneratorState::Yielded(vm.stack_mut().pop()?)),
                halt => {
                    return Err(VmError::from(VmErrorKind::Halted {
                        halt: halt.into_info(),
                    }))
                }
            }

            if len == 1 {
                let value = vm.stack_mut().pop()?;
                debug_assert!(vm.stack().is_empty(), "the final vm should be empty");
                self.vms.clear();
                return Ok(GeneratorState::Complete(value));
            }

            self.pop_vm()?;
        }
    }
/// Resume the current execution with support for async instructions.
Resume the current execution with support for async instructions.
Resume the current execution with support for async instructions .
pub async fn async_resume(&mut self) -> Result<GeneratorState, VmError> {
        loop {
            let len = self.vms.len();
            let vm = self.vm_mut()?;
            match Self::run(vm)? {
                VmHalt::Exited => (),
                VmHalt::Awaited(awaited) => {
                    awaited.into_vm(vm).await?;
                    continue;
                }
                VmHalt::VmCall(vm_call) => {
                    vm_call.into_execution(self)?;
                    continue;
                }
                VmHalt::Yielded => return Ok(GeneratorState::Yielded(vm.stack_mut().pop()?)),
                halt => {
                    return Err(VmError::from(VmErrorKind::Halted {
                        halt: halt.into_info(),
                    }))
                }
            }
            if len == 1 {
                let value = vm.stack_mut().pop()?;
                debug_assert!(vm.stack().is_empty(), "the final vm should be empty");
                self.vms.clear();
                return Ok(GeneratorState::Complete(value));
            }
            self.pop_vm()?;
        }
    }
pub async fn async_resume ( & mut self ) -> Result < GeneratorState , VmError > { loop { let len = self . vms . len ( ) ; let vm = self . vm_mut ( ) ? ; match Self :: run ( vm ) ? { VmHalt :: Exited => ( ) , VmHalt :: Awaited ( awaited ) => { awaited . into_vm ( vm ) . await ? ; continue ; } VmHalt :: VmCall ( vm_call ) => { vm_call . into_execution ( self ) ? ; continue ; } VmHalt :: Yielded => return Ok ( GeneratorState :: Yielded ( vm . stack_mut ( ) . pop ( ) ? ) ) , halt => { return Err ( VmError :: from ( VmErrorKind :: Halted { halt : halt . into_info ( ) , } ) ) } } if len == 1 { let value = vm . stack_mut ( ) . pop ( ) ? ; debug_assert ! ( vm stack ( ) is_empty ( ) " " ) ; self . vms . clear ( ) ; return Ok ( GeneratorState :: Complete ( value ) ) ; } self . pop_vm ( ) ? ; } }
Resume the current execution with support for async instructions.
Resume the current execution with support for async instructions .
&mut self
&mut self