Trait ark_api::world::ComponentTrait
source · pub trait ComponentTrait: Debug + Sized {
// Required methods
fn get_type() -> ComponentType;
fn from_entity(handle: Entity) -> Self;
fn try_from_entity(handle: Entity) -> Option<Self>;
fn entity(&self) -> Entity;
}Expand description
Common interface that components expose.
Required Methods§
sourcefn get_type() -> ComponentType
fn get_type() -> ComponentType
The type of the component, as a ComponentType enum.
sourcefn from_entity(handle: Entity) -> Self
fn from_entity(handle: Entity) -> Self
Adopt an Entity, wrap in a component struct.
sourcefn try_from_entity(handle: Entity) -> Option<Self>
fn try_from_entity(handle: Entity) -> Option<Self>
Try to adopt an Entity, wrapping it in a component struct.