make map length getter use length field

This commit is contained in:
bgkillas 2025-08-18 14:54:18 -04:00
parent 525b5dfba2
commit fb56e2f1d9
2 changed files with 9 additions and 4 deletions

View file

@ -509,10 +509,10 @@ impl<K: 'static, V: 'static> StdMap<K, V> {
} }
} }
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.iter().count() self.len
} }
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.iter().next().is_none() self.len == 0
} }
pub fn iter_keys(&self) -> impl Iterator<Item = &'static K> { pub fn iter_keys(&self) -> impl Iterator<Item = &'static K> {
self.iter().map(|(k, _)| k) self.iter().map(|(k, _)| k)

View file

@ -422,17 +422,22 @@ impl BitSet<8> {
} }
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Default)] #[derive(Debug)]
pub struct ComponentSystemManager { pub struct ComponentSystemManager {
pub update_order: StdVec<&'static ComponentSystem>, pub update_order: StdVec<&'static ComponentSystem>,
pub component_updaters: StdVec<&'static ComponentUpdater>, pub component_updaters: StdVec<&'static ComponentUpdater>,
pub map: StdMap<StdString, [*const usize; 4]>, pub component_vtables: StdMap<StdString, ComponentLuaVTable>,
pub unk: [*const usize; 8], pub unk: [*const usize; 8],
pub unk2: StdVec<*const usize>, pub unk2: StdVec<*const usize>,
pub unk3: [*const usize; 7], pub unk3: [*const usize; 7],
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct ComponentLuaVTable {
unk: [*const usize; 16],
}
#[repr(C)]
#[derive(Debug)]
pub struct ComponentUpdater { pub struct ComponentUpdater {
pub vtable: &'static ComponentUpdaterVTable, pub vtable: &'static ComponentUpdaterVTable,
pub name: StdString, pub name: StdString,