fn component_kind_ui(
        &mut self,
        ui: &mut egui::Ui,
        components: impl Fn(&Archetype) -> &[ComponentId],
        title: &str,
        entity: Entity,
        params: &WorldInspectorParams,
        id: egui::Id,
    ) -> bool {
        let (entity_location, components) = {
            let entity_ref = match self.world.get_entity(entity) {
                Some(entity_ref) => entity_ref,
                None => {
                    ui.label("Entity does not exist");
                    return false;
                }
            };
            let entity_location = entity_ref.location();
            let archetype = entity_ref.archetype();

            let components = components(archetype).to_vec();
            (entity_location, components)
        };

        if !components.is_empty() {
            ui.label(title);

            let mut components: Vec<_> = components
                .iter()
                .map(|component_id| {
                    let component_info = self.world.components().get_info(*component_id).unwrap();
                    let name = pretty_type_name_str(component_info.name());
                    (
                        name,
                        component_info.id(),
                        component_info.type_id(),
                        component_info.layout().size(),
                    )
                })
                .collect();

            if params.sort_components {
                components.sort_by(|a, b| a.0.cmp(&b.0));
            }

            let mut changed = false;
            for (name, component_id, component_type_id, size) in components {
                let is_zst = size == 0;
                changed |= unsafe {
                    self.component_ui(
                        ui,
                        name,
                        entity,
                        entity_location,
                        component_id,
                        component_type_id,
                        is_zst,
                        params,
                        id,
                    )
                }
            }
            changed
        } else {
            false
        }
    }
/// 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 .
fn component_kind_ui(
        &mut self,
        ui: &mut egui::Ui,
        components: impl Fn(&Archetype) -> &[ComponentId],
        title: &str,
        entity: Entity,
        params: &WorldInspectorParams,
        id: egui::Id,
    ) -> bool {
        let (entity_location, components) = {
            let entity_ref = match self.world.get_entity(entity) {
                Some(entity_ref) => entity_ref,
                None => {
                    ui.label("Entity does not exist");
                    return false;
                }
            };
            let entity_location = entity_ref.location();
            let archetype = entity_ref.archetype();
            let components = components(archetype).to_vec();
            (entity_location, components)
        };
        if !components.is_empty() {
            ui.label(title);
            let mut components: Vec<_> = components
                .iter()
                .map(|component_id| {
                    let component_info = self.world.components().get_info(*component_id).unwrap();
                    let name = pretty_type_name_str(component_info.name());
                    (
                        name,
                        component_info.id(),
                        component_info.type_id(),
                        component_info.layout().size(),
                    )
                })
                .collect();
            if params.sort_components {
                components.sort_by(|a, b| a.0.cmp(&b.0));
            }
            let mut changed = false;
            for (name, component_id, component_type_id, size) in components {
                let is_zst = size == 0;
                changed |= unsafe {
                    self.component_ui(
                        ui,
                        name,
                        entity,
                        entity_location,
                        component_id,
                        component_type_id,
                        is_zst,
                        params,
                        id,
                    )
                }
            }
            changed
        } else {
            false
        }
    }
fn component_kind_ui ( & mut self , ui : & mut egui :: Ui , components : impl Fn ( & Archetype ) -> & [ ComponentId ] , title : & str , entity : Entity , params : & WorldInspectorParams , id : egui :: Id , ) -> bool { let ( entity_location , components ) = { let entity_ref = match self . world . get_entity ( entity ) { Some ( entity_ref ) => entity_ref , None => { ui . label ( " " ) ; return false ; } } ; let entity_location = entity_ref . location ( ) ; let archetype = entity_ref . archetype ( ) ; let components = components ( archetype ) . to_vec ( ) ; ( entity_location , components ) } ; if ! components . is_empty ( ) { ui . label ( title ) ; let mut components : Vec < _ > = components . iter ( ) . map ( | component_id | { let component_info = self . world . components ( ) . get_info ( * component_id ) . unwrap ( ) ; let name = pretty_type_name_str ( component_info . name ( ) ) ; ( name , component_info . id ( ) , component_info . type_id ( ) , component_info . layout ( ) . size ( ) , ) } ) . collect ( ) ; if params . sort_components { components . sort_by ( | a , b | a . 0 . cmp ( & b . 0 ) ) ; } let mut changed = false ; for ( name , component_id , component_type_id , size ) in components { let is_zst = size == 0 ; changed |= unsafe { self . component_ui ( ui , name , entity , entity_location , component_id , component_type_id , is_zst , params , id , ) } } changed } else { false } }
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
components
impl Fn(&Archetype) -> &[ComponentId]
title
&str
entity
Entity
params
&WorldInspectorParams
id
egui::Id
&mut self
ui
&mut egui::Ui
components
impl Fn(&Archetype) -> &[ComponentId]
title
&str
entity
Entity
params
&WorldInspectorParams
id
egui::Id