[−][src]Struct dces::prelude::StringComponentStore
The StringComponentStore
stores the components of entities and uses strings as component keys. It could be used to
borrow the components of the entities.
Implementations
impl StringComponentStore
[src]
pub fn entities_of_component(
&self,
key: impl Into<String>,
entity: Entity
) -> Vec<Entity>
[src]
&self,
key: impl Into<String>,
entity: Entity
) -> Vec<Entity>
Returns a list of entities that references the same component.
pub fn register<C: Component>(
&mut self,
key: impl Into<String>,
entity: Entity,
component: C
)
[src]
&mut self,
key: impl Into<String>,
entity: Entity,
component: C
)
Register a component
for the given entity
.
pub fn register_shared<C: Component>(
&mut self,
key: &str,
target: Entity,
source: Entity
)
[src]
&mut self,
key: &str,
target: Entity,
source: Entity
)
Registers a sharing of the given component between the given entities. Uses as source key the component key.
pub fn register_shared_by_source_key<C: Component>(
&mut self,
key: &str,
source_key: &str,
target: Entity,
source: Entity
)
[src]
&mut self,
key: &str,
source_key: &str,
target: Entity,
source: Entity
)
Registers a sharing of the given component between the given entities.
pub fn register_shared_box(
&mut self,
key: &str,
target: Entity,
source: SharedComponentBox
)
[src]
&mut self,
key: &str,
target: Entity,
source: SharedComponentBox
)
Registers a sharing of the given component between the given entities. Uses as source key the component key.
pub fn register_shared_box_by_source_key(
&mut self,
key: &str,
source_key: &str,
target: Entity,
source: SharedComponentBox
)
[src]
&mut self,
key: &str,
source_key: &str,
target: Entity,
source: SharedComponentBox
)
Registers a sharing of the given component between the given entities.
pub fn register_box(
&mut self,
key: &str,
entity: Entity,
component_box: ComponentBox
)
[src]
&mut self,
key: &str,
entity: Entity,
component_box: ComponentBox
)
Register a component_box
for the given entity
.
pub fn len(&self) -> usize
[src]
Returns the number of components in the store.
pub fn is_empty(&self) -> bool
[src]
Returns true if the components are empty.
pub fn contains_entity(&self, entity: Entity) -> bool
[src]
Returns true
if the store contains the specific entity.
pub fn is_origin<C: Component>(&self, key: &str, entity: Entity) -> bool
[src]
Returns true
if entity is the origin of the requested component false
.
pub fn get<C: Component>(
&self,
key: &str,
entity: Entity
) -> Result<&C, NotFound>
[src]
&self,
key: &str,
entity: Entity
) -> Result<&C, NotFound>
Returns a reference of a component of type C
from the given entity
. If the entity does
not exists or it doesn't have a component of type C
NotFound
will be returned.
pub fn get_mut<C: Component>(
&mut self,
key: &str,
entity: Entity
) -> Result<&mut C, NotFound>
[src]
&mut self,
key: &str,
entity: Entity
) -> Result<&mut C, NotFound>
Returns a mutable reference of a component of type C
from the given entity
. If the entity does
not exists or it doesn't have a component of type C
NotFound
will be returned.
Trait Implementations
impl ComponentStore for StringComponentStore
[src]
type Components = (HashMap<String, Box<dyn Any>>, HashMap<String, (Entity, String)>)
fn append(&mut self, entity: Entity, components: Self::Components)
[src]
fn remove_entity(&mut self, entity: impl Into<Entity>)
[src]
fn print_entity(&self, entity: impl Into<Entity>)
[src]
impl Debug for StringComponentStore
[src]
impl Default for StringComponentStore
[src]
fn default() -> StringComponentStore
[src]
Auto Trait Implementations
impl !RefUnwindSafe for StringComponentStore
impl !Send for StringComponentStore
impl !Sync for StringComponentStore
impl Unpin for StringComponentStore
impl !UnwindSafe for StringComponentStore
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<E> Component for E where
E: Any,
[src]
E: 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>,