[−][src]Struct akashi::ecs::component::ComponentManager
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]
&mut self,
name: &str,
store: V
) -> Result<(), Error> where
U: Component<T> + 'static,
V: ComponentBackend<T, U> + Sync + Send + 'static,
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]
&self,
entity: &T,
component: U
) -> Result<(), Error>
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]
&self,
entity: &T
) -> Result<Option<U>, Error>
Load data for a Component
from the appropriate backing store.
pub fn delete_component<U: Component<T> + 'static>(
&self,
entity: &T
) -> Result<(), Error>
[src]
&self,
entity: &T
) -> Result<(), Error>
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]
&self,
entity: &T,
type_id: &TypeId
) -> Result<(), Error>
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]
&self,
entity: &T
) -> Result<bool, Error>
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]
T: Entity + 'static,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,