[][src]Struct tiny_ecs::ComponentMap

pub struct ComponentMap<T> { /* fields omitted */ }

ComponentMap is a container type for the components used by entities

Methods

impl<T> ComponentMap<T>[src]

pub fn get_part_ref(&self, id: usize) -> Result<&T, ECSError>[src]

Getting a reference to an entity part requires the entity ID

pub fn get_part_mut(&mut self, id: usize) -> Result<&mut T, ECSError>[src]

Getting a mutable reference to an entity part requires the entity ID

Example

#[derive(Debug, PartialEq)]
struct Test1 {}

let components = entities.borrow::<Test1>().unwrap();
let part = components.get_part_ref(entity_1).unwrap();
assert_eq!(part, &Test1 {});
// or
let part = components.get_part_ref(entity_1).unwrap();
assert_eq!(part, &Test1 {});

pub fn get(&self) -> &VecMap<T>[src]

Returns a borrow of the inner hashmap of components

pub fn get_mut(&mut self) -> &mut VecMap<T>[src]

Returns a mutable borrow of the inner hashmap of components

Trait Implementations

impl<T: Debug> Debug for ComponentMap<T>[src]

Auto Trait Implementations

impl<T> Send for ComponentMap<T> where
    T: Send

impl<T> Unpin for ComponentMap<T> where
    T: Unpin

impl<T> Sync for ComponentMap<T> where
    T: Sync

impl<T> UnwindSafe for ComponentMap<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for ComponentMap<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]