[][src]Trait akashi::ComponentBackend

pub trait ComponentBackend<T, U> where
    T: Entity + 'static,
    U: Component<T> + 'static, 
{ fn load(&self, entity: &T) -> Result<Option<U>, Error>;
fn store(&self, entity: &T, component: U) -> Result<(), Error>;
fn exists(&self, entity: &T) -> Result<bool, Error>;
fn delete(&self, entity: &T) -> Result<(), Error>; }

This trait is used to mark backing storage objects for Components.

Structs that implement this trait can be passed to ComponentManager::register_component to allow Entities to load and store Component data.

Required methods

fn load(&self, entity: &T) -> Result<Option<U>, Error>

Loads an instance of a Component from storage.

fn store(&self, entity: &T, component: U) -> Result<(), Error>

Saves an instance of a Component to storage.

fn exists(&self, entity: &T) -> Result<bool, Error>

Check to see if there is any stored Component data associated with an Entity.

fn delete(&self, entity: &T) -> Result<(), Error>

Delete the stored Component data associated with the given Entity, if any.

Loading content...

Implementors

impl<E, F, T, W> ComponentBackend<E, T> for ComponentAdapter<E, F, T, W> where
    E: Entity + 'static,
    F: Into<T> + Component<E> + 'static,
    T: Into<F> + Component<E> + 'static,
    W: ComponentBackend<E, F> + Sync + Send
[src]

impl<T, U> ComponentBackend<T, U> for LocalComponentStorage<T, U> where
    T: Entity + 'static,
    U: Component<T> + Clone + 'static, 
[src]

Loading content...