moltrun 1.7.2

High-performance game engine library with AI capabilities, built on wgpu for modern 3D graphics and physics simulation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::any::Any;

/// Component trait - 모든 컴포넌트가 구현해야 하는 기본 인터페이스
pub trait Component: Any + Send + Sync {
    /// Component를 Any 타입으로 변환 (타입 캐스팅용)
    fn as_any(&self) -> &dyn Any;
    
    fn as_any_mut(&mut self) -> &mut dyn Any;
    
    /// Component를 복제 (Clone이 구현된 경우)
    fn clone_box(&self) -> Box<dyn Component>;
    
    /// Component의 타입 이름 반환 (디버깅용)
    fn type_name(&self) -> &'static str {
        std::any::type_name::<Self>()
    }
}