pub struct EntitiesAndComponents { /* private fields */ }

Implementations§

source§

impl EntitiesAndComponents

source

pub fn new() -> Self

source

pub fn get_components(&self, entity: Entity) -> &AnyMap

Gets a reference to all the components on an entity Returns an AnyMap, which can be used to get a reference to a component This should rarely if ever be used

source

pub fn get_components_mut(&mut self, entity: Entity) -> &mut AnyMap

Gets a mutable reference to the components on an entity If the entity does not exist, it will panic

source

pub fn try_get_component<T: 'static>(&self, entity: Entity) -> Option<&Box<T>>

Gets a reference to a component on an entity If the component does not exist on the entity, it will return None

source

pub fn try_get_component_mut<T: 'static>( &mut self, entity: Entity ) -> Option<&mut Box<T>>

Gets a mutable reference to a component on an entity If the component does not exist on the entity, it will return None

source

pub fn get_component<T: 'static>(&self, entity: Entity) -> &T

Gets a reference to a component on an entity If the component does not exist on the entity, it will panic

source

pub fn get_component_mut<T: 'static>(&mut self, entity: Entity) -> &mut T

Gets a mutable reference to a component on an entity If the component does not exist on the entity, it will panic

source

pub fn add_entity(&mut self) -> Entity

Adds an entity to the game engine Returns the entity

source

pub fn add_component_to<T: Component>(&mut self, entity: Entity, component: T)

Adds a component to an entity If the component already exists on the entity, it will be overwritten

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Any for T
where T: Any,