fn mutate_with_update_context<F, R>(&mut self, f: F) -> R
    where
        F: for<'a, 'gc> FnOnce(&mut UpdateContext<'a, 'gc, '_>) -> R,
    {
        // We have to do this piecewise borrowing of fields before the closure to avoid
        // completely borrowing `self`.
        let (
            player_version,
            swf,
            background_color,
            renderer,
            audio,
            navigator,
            ui,
            rng,
            mouse_position,
            stage_width,
            stage_height,
            player,
            system_properties,
            instance_counter,
            storage,
            locale,
            logging,
            needs_render,
            max_execution_duration,
            current_frame,
            time_offset,
        ) = (
            self.player_version,
            &self.swf,
            &mut self.background_color,
            self.renderer.deref_mut(),
            self.audio.deref_mut(),
            self.navigator.deref_mut(),
            self.ui.deref_mut(),
            &mut self.rng,
            &self.mouse_pos,
            Twips::from_pixels(self.movie_width.into()),
            Twips::from_pixels(self.movie_height.into()),
            self.self_reference.clone(),
            &mut self.system,
            &mut self.instance_counter,
            self.storage.deref_mut(),
            self.locale.deref_mut(),
            self.log.deref_mut(),
            &mut self.needs_render,
            self.max_execution_duration,
            &mut self.current_frame,
            &mut self.time_offset,
        );

        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 focus_tracker = root_data.focus_tracker;
            let (
                levels,
                library,
                action_queue,
                avm1,
                avm2,
                drag_object,
                load_manager,
                shared_objects,
                unbound_text_fields,
                timers,
                external_interface,
                audio_manager,
            ) = root_data.update_context_params();

            let mut update_context = UpdateContext {
                player_version,
                swf,
                library,
                background_color,
                rng,
                renderer,
                audio,
                navigator,
                ui,
                action_queue,
                gc_context,
                levels,
                mouse_hovered_object,
                mouse_position,
                drag_object,
                stage_size: (stage_width, stage_height),
                player,
                load_manager,
                system: system_properties,
                instance_counter,
                storage,
                locale,
                log: logging,
                shared_objects,
                unbound_text_fields,
                timers,
                needs_render,
                avm1,
                avm2,
                external_interface,
                update_start: Instant::now(),
                max_execution_duration,
                focus_tracker,
                times_get_time_called: 0,
                time_offset,
                audio_manager,
            };

            let ret = f(&mut update_context);

            *current_frame = update_context
                .levels
                .get(&0)
                .and_then(|root| root.as_movie_clip())
                .map(|clip| clip.current_frame());

            // Hovered object may have been updated; copy it back to the GC root.
            root_data.mouse_hovered_object = update_context.mouse_hovered_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,
    {
        // We have to do this piecewise borrowing of fields before the closure to avoid
        // completely borrowing `self`.
        let (
            player_version,
            swf,
            background_color,
            renderer,
            audio,
            navigator,
            ui,
            rng,
            mouse_position,
            stage_width,
            stage_height,
            player,
            system_properties,
            instance_counter,
            storage,
            locale,
            logging,
            needs_render,
            max_execution_duration,
            current_frame,
            time_offset,
        ) = (
            self.player_version,
            &self.swf,
            &mut self.background_color,
            self.renderer.deref_mut(),
            self.audio.deref_mut(),
            self.navigator.deref_mut(),
            self.ui.deref_mut(),
            &mut self.rng,
            &self.mouse_pos,
            Twips::from_pixels(self.movie_width.into()),
            Twips::from_pixels(self.movie_height.into()),
            self.self_reference.clone(),
            &mut self.system,
            &mut self.instance_counter,
            self.storage.deref_mut(),
            self.locale.deref_mut(),
            self.log.deref_mut(),
            &mut self.needs_render,
            self.max_execution_duration,
            &mut self.current_frame,
            &mut self.time_offset,
        );
        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 focus_tracker = root_data.focus_tracker;
            let (
                levels,
                library,
                action_queue,
                avm1,
                avm2,
                drag_object,
                load_manager,
                shared_objects,
                unbound_text_fields,
                timers,
                external_interface,
                audio_manager,
            ) = root_data.update_context_params();
            let mut update_context = UpdateContext {
                player_version,
                swf,
                library,
                background_color,
                rng,
                renderer,
                audio,
                navigator,
                ui,
                action_queue,
                gc_context,
                levels,
                mouse_hovered_object,
                mouse_position,
                drag_object,
                stage_size: (stage_width, stage_height),
                player,
                load_manager,
                system: system_properties,
                instance_counter,
                storage,
                locale,
                log: logging,
                shared_objects,
                unbound_text_fields,
                timers,
                needs_render,
                avm1,
                avm2,
                external_interface,
                update_start: Instant::now(),
                max_execution_duration,
                focus_tracker,
                times_get_time_called: 0,
                time_offset,
                audio_manager,
            };
            let ret = f(&mut update_context);
            *current_frame = update_context
                .levels
                .get(&0)
                .and_then(|root| root.as_movie_clip())
                .map(|clip| clip.current_frame());
            // Hovered object may have been updated; copy it back to the GC root.
            root_data.mouse_hovered_object = update_context.mouse_hovered_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 , { // We have to do this piecewise borrowing of fields before the closure to avoid // completely borrowing `self`. let ( player_version , swf , background_color , renderer , audio , navigator , ui , rng , mouse_position , stage_width , stage_height , player , system_properties , instance_counter , storage , locale , logging , needs_render , max_execution_duration , current_frame , time_offset , ) = ( self . player_version , & self . swf , & mut self . background_color , self . renderer . deref_mut ( ) , self . audio . deref_mut ( ) , self . navigator . deref_mut ( ) , self . ui . deref_mut ( ) , & mut self . rng , & self . mouse_pos , Twips :: from_pixels ( self . movie_width . into ( ) ) , Twips :: from_pixels ( self . movie_height . into ( ) ) , self . self_reference . clone ( ) , & mut self . system , & mut self . instance_counter , self . storage . deref_mut ( ) , self . locale . deref_mut ( ) , self . log . deref_mut ( ) , & mut self . needs_render , self . max_execution_duration , & mut self . current_frame , & mut self . time_offset , ) ; 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 focus_tracker = root_data . focus_tracker ; let ( levels , library , action_queue , avm1 , avm2 , drag_object , load_manager , shared_objects , unbound_text_fields , timers , external_interface , audio_manager , ) = root_data . update_context_params ( ) ; let mut update_context = UpdateContext { player_version , swf , library , background_color , rng , renderer , audio , navigator , ui , action_queue , gc_context , levels , mouse_hovered_object , mouse_position , drag_object , stage_size : ( stage_width , stage_height ) , player , load_manager , system : system_properties , instance_counter , storage , locale , log : logging , shared_objects , unbound_text_fields , timers , needs_render , avm1 , avm2 , external_interface , update_start : Instant :: now ( ) , max_execution_duration , focus_tracker , times_get_time_called : 0 , time_offset , audio_manager , } ; let ret = f ( & mut update_context ) ; * current_frame = update_context . levels . get ( & 0 ) . and_then ( | root | root . as_movie_clip ( ) ) . map ( | clip | clip . current_frame ( ) ) ; // Hovered object may have been updated; copy it back to the GC root. root_data . mouse_hovered_object = update_context . mouse_hovered_object ; ret } ) }
Runs the closure `f` with an `UpdateContext`.
Runs the closure ` f ` with an ` UpdateContext ` .
&mut self
f
F
&mut self
f
F