🔥 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,5 +1,32 @@
//! Key types and functions for creating actions, components, packages, and themes.
use crate::util;
use std::any::Any;
// Common definitions for core types.
pub trait AnyBase: Any {
fn single_name(&self) -> &'static str;
fn as_any_ref(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
}
impl<T: Any> AnyBase for T {
fn single_name(&self) -> &'static str {
util::single_type_name::<Self>()
}
fn as_any_ref(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
// API to define functions that alter the behavior of PageTop core.
pub mod action;