unsafe fn component_ui(
        &mut self,
        ui: &mut egui::Ui,
        name: String,
        entity: Entity,
        entity_location: EntityLocation,
        component_id: ComponentId,
        component_type_id: Option<TypeId>,
        is_zst: bool,
        params: &WorldInspectorParams,
        id: egui::Id,
    ) -> bool {
        let type_id = match component_type_id {
            Some(id) => id,
            None => {
                ui.label("No type id");
                return false;
            }
        };

        if params.should_ignore_component(type_id) {
            return false;
        }

        // Safety: according to this function's contract, entity_location is valid,
        // and self.world gives us exclusive access.
        let (component_ptr, component_ticks) = {
            let (ptr, ticks) =
                get_component_and_ticks(self.world, component_id, entity, entity_location).unwrap();
            (ptr, { &mut *ticks })
        };

        if params.highlight_changes
            && component_ticks
                .is_changed(self.world.last_change_tick(), self.world.read_change_tick())
        {
            ui.style_mut().visuals.collapsing_header_frame = true;
            ui.style_mut().visuals.widgets.inactive.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.active.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.hovered.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.noninteractive.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
        }

        let id = id.with(component_id);
        let changed = CollapsingHeader::new(name)
            .id_source(id)
            .show(ui, |ui| {
                ui.reset_style();

                if params.is_read_only(type_id) {
                    ui.set_enabled(false);
                }

                let result = self.world.resource_scope(
                    |world, inspectable_registry: Mut<InspectableRegistry>| {
                        world.resource_scope(|world, type_registry: Mut<TypeRegistryArc>| {
                            let type_registry = &*type_registry.internal.read();

                            // Safety: according to this function's contract, entity_location (and therefore component_ptr) are valid
                            try_display(
                                world,
                                entity,
                                component_ptr,
                                is_zst,
                                type_id,
                                &*inspectable_registry,
                                type_registry,
                                ui,
                                self.ui_ctx,
                                id,
                            )
                        })
                    },
                );

                if result.is_err() {
                    no_inspectable_error_message(ui);
                }

                result.unwrap_or(false)
            })
            .body_returned
            .unwrap_or(false);

        if changed {
            component_ticks.set_changed(self.world.change_tick());
        }

        ui.reset_style();
        changed
    }
/// Safety:
/// `entity_location` must point to a valid archetype and index.
`entity_location` must point to a valid archetype and index.
` entity_location ` must point to a valid archetype and index .
unsafe fn component_ui(
        &mut self,
        ui: &mut egui::Ui,
        name: String,
        entity: Entity,
        entity_location: EntityLocation,
        component_id: ComponentId,
        component_type_id: Option<TypeId>,
        is_zst: bool,
        params: &WorldInspectorParams,
        id: egui::Id,
    ) -> bool {
        let type_id = match component_type_id {
            Some(id) => id,
            None => {
                ui.label("No type id");
                return false;
            }
        };
        if params.should_ignore_component(type_id) {
            return false;
        }
        // Safety: according to this function's contract, entity_location is valid,
        // and self.world gives us exclusive access.
        let (component_ptr, component_ticks) = {
            let (ptr, ticks) =
                get_component_and_ticks(self.world, component_id, entity, entity_location).unwrap();
            (ptr, { &mut *ticks })
        };
        if params.highlight_changes
            && component_ticks
                .is_changed(self.world.last_change_tick(), self.world.read_change_tick())
        {
            ui.style_mut().visuals.collapsing_header_frame = true;
            ui.style_mut().visuals.widgets.inactive.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.active.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.hovered.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
            ui.style_mut().visuals.widgets.noninteractive.bg_stroke = egui::Stroke {
                width: 1.0,
                color: egui::Color32::GOLD,
            };
        }
        let id = id.with(component_id);
        let changed = CollapsingHeader::new(name)
            .id_source(id)
            .show(ui, |ui| {
                ui.reset_style();
                if params.is_read_only(type_id) {
                    ui.set_enabled(false);
                }
                let result = self.world.resource_scope(
                    |world, inspectable_registry: Mut<InspectableRegistry>| {
                        world.resource_scope(|world, type_registry: Mut<TypeRegistryArc>| {
                            let type_registry = &*type_registry.internal.read();
                            // Safety: according to this function's contract, entity_location (and therefore component_ptr) are valid
                            try_display(
                                world,
                                entity,
                                component_ptr,
                                is_zst,
                                type_id,
                                &*inspectable_registry,
                                type_registry,
                                ui,
                                self.ui_ctx,
                                id,
                            )
                        })
                    },
                );
                if result.is_err() {
                    no_inspectable_error_message(ui);
                }
                result.unwrap_or(false)
            })
            .body_returned
            .unwrap_or(false);
        if changed {
            component_ticks.set_changed(self.world.change_tick());
        }
        ui.reset_style();
        changed
    }
unsafe fn component_ui ( & mut self , ui : & mut egui :: Ui , name : String , entity : Entity , entity_location : EntityLocation , component_id : ComponentId , component_type_id : Option < TypeId > , is_zst : bool , params : & WorldInspectorParams , id : egui :: Id , ) -> bool { let type_id = match component_type_id { Some ( id ) => id , None => { ui . label ( " " ) ; return false ; } } ; if params . should_ignore_component ( type_id ) { return false ; } // Safety: according to this function's contract, entity_location is valid, // and self.world gives us exclusive access. let ( component_ptr , component_ticks ) = { let ( ptr , ticks ) = get_component_and_ticks ( self . world , component_id , entity , entity_location ) . unwrap ( ) ; ( ptr , { & mut * ticks } ) } ; if params . highlight_changes && component_ticks . is_changed ( self . world . last_change_tick ( ) , self . world . read_change_tick ( ) ) { ui . style_mut ( ) . visuals . collapsing_header_frame = true ; ui . style_mut ( ) . visuals . widgets . inactive . bg_stroke = egui :: Stroke { width : 1.0 , color : egui :: Color32 :: GOLD , } ; ui . style_mut ( ) . visuals . widgets . active . bg_stroke = egui :: Stroke { width : 1.0 , color : egui :: Color32 :: GOLD , } ; ui . style_mut ( ) . visuals . widgets . hovered . bg_stroke = egui :: Stroke { width : 1.0 , color : egui :: Color32 :: GOLD , } ; ui . style_mut ( ) . visuals . widgets . noninteractive . bg_stroke = egui :: Stroke { width : 1.0 , color : egui :: Color32 :: GOLD , } ; } let id = id . with ( component_id ) ; let changed = CollapsingHeader :: new ( name ) . id_source ( id ) . show ( ui , | ui | { ui . reset_style ( ) ; if params . is_read_only ( type_id ) { ui . set_enabled ( false ) ; } let result = self . world . resource_scope ( | world , inspectable_registry : Mut < InspectableRegistry > | { world . resource_scope ( | world , type_registry : Mut < TypeRegistryArc > | { let type_registry = & * type_registry . internal . read ( ) ; // Safety: according to this function's contract, entity_location (and therefore component_ptr) are valid try_display ( world , entity , component_ptr , is_zst , type_id , & * inspectable_registry , type_registry , ui , self . ui_ctx , id , ) } ) } , ) ; if result . is_err ( ) { no_inspectable_error_message ( ui ) ; } result . unwrap_or ( false ) } ) . body_returned . unwrap_or ( false ) ; if changed { component_ticks . set_changed ( self . world . change_tick ( ) ) ; } ui . reset_style ( ) ; changed }
Safety:
`entity_location` must point to a valid archetype and index.
Safety : ` entity_location ` must point to a valid archetype and index .
&mut self
ui
&mut egui::Ui
name
String
entity
Entity
entity_location
EntityLocation
component_id
ComponentId
component_type_id
Option<TypeId>
is_zst
bool
params
&WorldInspectorParams
id
egui::Id
&mut self
ui
&mut egui::Ui
name
String
entity
Entity
entity_location
EntityLocation
component_id
ComponentId
component_type_id
Option<TypeId>
is_zst
bool
params
&WorldInspectorParams
id
egui::Id