18 lines
398 B
Rust
18 lines
398 B
Rust
|
use std::{any::{TypeId, type_name}, alloc::Layout};
|
||
|
|
||
|
#[derive(Clone, Debug)]
|
||
|
pub struct ComponentInfo {
|
||
|
pub type_id: TypeId,
|
||
|
pub name: String,
|
||
|
pub layout: Layout,
|
||
|
}
|
||
|
|
||
|
impl ComponentInfo {
|
||
|
pub fn new<T: 'static>() -> Self {
|
||
|
Self {
|
||
|
type_id: TypeId::of::<T>(),
|
||
|
name: type_name::<T>().to_string(),
|
||
|
layout: Layout::new::<T>(),
|
||
|
}
|
||
|
}
|
||
|
}
|