[][src]Struct akashi::ecs::component::ComponentManager

pub struct ComponentManager<T: Entity + 'static> { /* fields omitted */ }

Manages operations related to Components, such as saving and loading Component data.

Typically, you won't need to call any methods on ComponentManager objects aside from register_component, since the corresponding Entity trait methods will do so for you.

Errors

Most of the methods on this object ultimately end up wrapping methods on registered Component storage objects. Errors returned from those methods will be passed through by methods on ComponentManager.

Additionally, attempts to perform operations with Component types for which no backing store has been registered with register_component will return TypeNotFoundError.

Methods

impl<T: Entity + 'static> ComponentManager<T>[src]

pub fn new() -> ComponentManager<T>[src]

pub fn register_component<U, V>(
    &mut self,
    name: &str,
    store: V
) -> Result<(), Error> where
    U: Component<T> + 'static,
    V: ComponentBackend<T, U> + Sync + Send + 'static, 
[src]

Registers a backing storage object and unique name for a Component type.

This registers a backing store and associated functions for a Component type, allowing Entities that use this manager to get/set Component data of that type.

pub fn is_registered<U: Component<T> + 'static>(&self) -> bool[src]

Check to see if a particular Component type has registered operations.

pub fn component_name(&self, type_id: &TypeId) -> Option<&str>[src]

pub fn component_type_id(&self, name: &str) -> Option<&TypeId>[src]

pub fn set_component<U: Component<T> + 'static>(
    &self,
    entity: &T,
    component: U
) -> Result<(), Error>
[src]

Save data for a Component to the appropriate backing store.

pub fn get_component<U: Component<T> + 'static>(
    &self,
    entity: &T
) -> Result<Option<U>, Error>
[src]

Load data for a Component from the appropriate backing store.

pub fn delete_component<U: Component<T> + 'static>(
    &self,
    entity: &T
) -> Result<(), Error>
[src]

Delete the data for an attached Component from its registered backing store.

pub fn delete_component_by_id(
    &self,
    entity: &T,
    type_id: &TypeId
) -> Result<(), Error>
[src]

Delete the data for a Component with the associated TypeId.

This should probably only be used internally.

pub fn component_exists<U: Component<T> + 'static>(
    &self,
    entity: &T
) -> Result<bool, Error>
[src]

Check to see if associated Component data exists for the given entity and Component type.

Trait Implementations

impl<T> Debug for ComponentManager<T> where
    T: Entity + 'static, 
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for ComponentManager<T>

impl<T> Send for ComponentManager<T>

impl<T> Sync for ComponentManager<T>

impl<T> Unpin for ComponentManager<T>

impl<T> !UnwindSafe for ComponentManager<T>

Blanket Implementations

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

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

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

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

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.