🔥 Refactor TypeId/Any use, drop own Handle

This commit is contained in:
Manuel Cillero 2024-02-16 17:00:34 +01:00
parent 8402b7946e
commit 169e562488
59 changed files with 137 additions and 289 deletions

View file

@ -1,6 +1,6 @@
use crate::core::component::{ComponentTrait, Context};
use crate::html::{html, Markup};
use crate::{fn_with, Handle, Weight};
use crate::{fn_with, TypeId, Weight};
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
@ -36,8 +36,8 @@ impl ArcAnyComponent {
// ArcAnyComponent HELPERS.
fn handle(&self) -> Handle {
self.0.read().unwrap().handle()
fn type_id(&self) -> TypeId {
self.0.read().unwrap().type_id()
}
fn id(&self) -> String {
@ -126,8 +126,8 @@ impl AnyComponents {
self.0.iter().filter(move |&c| c.id() == id)
}
pub fn iter_by_handle(&self, handle: Handle) -> impl Iterator<Item = &ArcAnyComponent> {
self.0.iter().filter(move |&c| c.handle() == handle)
pub fn iter_by_type_id(&self, type_id: TypeId) -> impl Iterator<Item = &ArcAnyComponent> {
self.0.iter().filter(move |&c| c.type_id() == type_id)
}
// AnyComponents RENDER.