fn mutate_with_update_context<F, R>(&mut self, f: F) -> R
    where
        F: for<'a, 'gc> FnOnce(&mut UpdateContext<'a, 'gc, '_>) -> R,
    {
        self.gc_arena.mutate(|gc_context, gc_root| {
            let mut root_data = gc_root.0.write(gc_context);
            let mouse_hovered_object = root_data.mouse_hovered_object;
            let mouse_pressed_object = root_data.mouse_pressed_object;
            let focus_tracker = root_data.focus_tracker;
            let (
                stage,
                library,
                action_queue,
                avm1,
                avm2,
                drag_object,
                load_manager,
                shared_objects,
                unbound_text_fields,
                timers,
                current_context_menu,
                external_interface,
                audio_manager,
            ) = root_data.update_context_params();

            let mut update_context = UpdateContext {
                player_version: self.player_version,
                swf: &self.swf,
                library,
                rng: &mut self.rng,
                renderer: self.renderer.deref_mut(),
                audio: self.audio.deref_mut(),
                navigator: self.navigator.deref_mut(),
                ui: self.ui.deref_mut(),
                action_queue,
                gc_context,
                stage,
                mouse_over_object: mouse_hovered_object,
                mouse_down_object: mouse_pressed_object,
                input: &self.input,
                mouse_position: &self.mouse_pos,
                drag_object,
                player: self.self_reference.clone(),
                load_manager,
                system: &mut self.system,
                instance_counter: &mut self.instance_counter,
                storage: self.storage.deref_mut(),
                locale: self.locale.deref_mut(),
                log: self.log.deref_mut(),
                video: self.video.deref_mut(),
                shared_objects,
                unbound_text_fields,
                timers,
                current_context_menu,
                needs_render: &mut self.needs_render,
                avm1,
                avm2,
                external_interface,
                update_start: Instant::now(),
                max_execution_duration: self.max_execution_duration,
                focus_tracker,
                times_get_time_called: 0,
                time_offset: &mut self.time_offset,
                audio_manager,
                frame_rate: &mut self.frame_rate,
            };

            let old_frame_rate = *update_context.frame_rate;

            let ret = f(&mut update_context);

            let new_frame_rate = *update_context.frame_rate;

            // If we changed the framerate, let the audio handler now.
            #[allow(clippy::float_cmp)]
            if old_frame_rate != new_frame_rate {
                update_context.audio.set_frame_rate(new_frame_rate);
            }

            self.current_frame = update_context
                .stage
                .root_clip()
                .as_movie_clip()
                .map(|clip| clip.current_frame());

            // Hovered object may have been updated; copy it back to the GC root.
            let mouse_hovered_object = update_context.mouse_over_object;
            let mouse_pressed_object = update_context.mouse_down_object;
            root_data.mouse_hovered_object = mouse_hovered_object;
            root_data.mouse_pressed_object = mouse_pressed_object;

            ret
        })
    }
/// Runs the closure `f` with an `UpdateContext`.
/// This takes cares of populating the `UpdateContext` struct, avoiding borrow issues.
Runs the closure `f` with an `UpdateContext`.
This takes cares of populating the `UpdateContext` struct, avoiding borrow issues.
Runs the closure ` f ` with an ` UpdateContext ` . This takes cares of populating the ` UpdateContext ` struct avoiding borrow issues .
fn mutate_with_update_context<F, R>(&mut self, f: F) -> R
    where
        F: for<'a, 'gc> FnOnce(&mut UpdateContext<'a, 'gc, '_>) -> R,
    {
        self.gc_arena.mutate(|gc_context, gc_root| {
            let mut root_data = gc_root.0.write(gc_context);
            let mouse_hovered_object = root_data.mouse_hovered_object;
            let mouse_pressed_object = root_data.mouse_pressed_object;
            let focus_tracker = root_data.focus_tracker;
            let (
                stage,
                library,
                action_queue,
                avm1,
                avm2,
                drag_object,
                load_manager,
                shared_objects,
                unbound_text_fields,
                timers,
                current_context_menu,
                external_interface,
                audio_manager,
            ) = root_data.update_context_params();
            let mut update_context = UpdateContext {
                player_version: self.player_version,
                swf: &self.swf,
                library,
                rng: &mut self.rng,
                renderer: self.renderer.deref_mut(),
                audio: self.audio.deref_mut(),
                navigator: self.navigator.deref_mut(),
                ui: self.ui.deref_mut(),
                action_queue,
                gc_context,
                stage,
                mouse_over_object: mouse_hovered_object,
                mouse_down_object: mouse_pressed_object,
                input: &self.input,
                mouse_position: &self.mouse_pos,
                drag_object,
                player: self.self_reference.clone(),
                load_manager,
                system: &mut self.system,
                instance_counter: &mut self.instance_counter,
                storage: self.storage.deref_mut(),
                locale: self.locale.deref_mut(),
                log: self.log.deref_mut(),
                video: self.video.deref_mut(),
                shared_objects,
                unbound_text_fields,
                timers,
                current_context_menu,
                needs_render: &mut self.needs_render,
                avm1,
                avm2,
                external_interface,
                update_start: Instant::now(),
                max_execution_duration: self.max_execution_duration,
                focus_tracker,
                times_get_time_called: 0,
                time_offset: &mut self.time_offset,
                audio_manager,
                frame_rate: &mut self.frame_rate,
            };
            let old_frame_rate = *update_context.frame_rate;
            let ret = f(&mut update_context);
            let new_frame_rate = *update_context.frame_rate;
            // If we changed the framerate, let the audio handler now.
            #[allow(clippy::float_cmp)]
            if old_frame_rate != new_frame_rate {
                update_context.audio.set_frame_rate(new_frame_rate);
            }
            self.current_frame = update_context
                .stage
                .root_clip()
                .as_movie_clip()
                .map(|clip| clip.current_frame());
            // Hovered object may have been updated; copy it back to the GC root.
            let mouse_hovered_object = update_context.mouse_over_object;
            let mouse_pressed_object = update_context.mouse_down_object;
            root_data.mouse_hovered_object = mouse_hovered_object;
            root_data.mouse_pressed_object = mouse_pressed_object;
            ret
        })
    }
fn mutate_with_update_context < F , R > ( & mut self , f : F ) -> R where F : for < ' a , ' gc > FnOnce ( & mut UpdateContext < ' a , ' gc , ' _ > ) -> R , { self . gc_arena . mutate ( | gc_context , gc_root | { let mut root_data = gc_root . 0 . write ( gc_context ) ; let mouse_hovered_object = root_data . mouse_hovered_object ; let mouse_pressed_object = root_data . mouse_pressed_object ; let focus_tracker = root_data . focus_tracker ; let ( stage , library , action_queue , avm1 , avm2 , drag_object , load_manager , shared_objects , unbound_text_fields , timers , current_context_menu , external_interface , audio_manager , ) = root_data . update_context_params ( ) ; let mut update_context = UpdateContext { player_version : self . player_version , swf : & self . swf , library , rng : & mut self . rng , renderer : self . renderer . deref_mut ( ) , audio : self . audio . deref_mut ( ) , navigator : self . navigator . deref_mut ( ) , ui : self . ui . deref_mut ( ) , action_queue , gc_context , stage , mouse_over_object : mouse_hovered_object , mouse_down_object : mouse_pressed_object , input : & self . input , mouse_position : & self . mouse_pos , drag_object , player : self . self_reference . clone ( ) , load_manager , system : & mut self . system , instance_counter : & mut self . instance_counter , storage : self . storage . deref_mut ( ) , locale : self . locale . deref_mut ( ) , log : self . log . deref_mut ( ) , video : self . video . deref_mut ( ) , shared_objects , unbound_text_fields , timers , current_context_menu , needs_render : & mut self . needs_render , avm1 , avm2 , external_interface , update_start : Instant :: now ( ) , max_execution_duration : self . max_execution_duration , focus_tracker , times_get_time_called : 0 , time_offset : & mut self . time_offset , audio_manager , frame_rate : & mut self . frame_rate , } ; let old_frame_rate = * update_context . frame_rate ; let ret = f ( & mut update_context ) ; let new_frame_rate = * update_context . frame_rate ; // If we changed the framerate, let the audio handler now. # [ allow ( clippy float_cmp ) ] if old_frame_rate != new_frame_rate { update_context . audio . set_frame_rate ( new_frame_rate ) ; } self . current_frame = update_context . stage . root_clip ( ) . as_movie_clip ( ) . map ( | clip | clip . current_frame ( ) ) ; // Hovered object may have been updated; copy it back to the GC root. let mouse_hovered_object = update_context . mouse_over_object ; let mouse_pressed_object = update_context . mouse_down_object ; root_data . mouse_hovered_object = mouse_hovered_object ; root_data . mouse_pressed_object = mouse_pressed_object ; ret } ) }
Runs the closure `f` with an `UpdateContext`.
Runs the closure ` f ` with an ` UpdateContext ` .
&mut self
f
F
&mut self
f
F