ecs_girvel_common 0.1.0

Common types for ecs_rs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::rc::Rc;

pub trait Component<T> {
    fn get_component(&self) -> Rc<T>;
}

pub trait Entity {
    fn get<T>(&self) -> Rc<T> where Self: Component<T>;
}

impl<E: ?Sized> Entity for E {
    fn get<T>(&self) -> Rc<T> where Self: Component<T> {Component::<T>::get_component(self)}
}