🔥 Refactor TypeId/Any use, drop own Handle
This commit is contained in:
parent
8402b7946e
commit
169e562488
59 changed files with 137 additions and 289 deletions
27
src/core.rs
27
src/core.rs
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue