Skip to content

Commit

Permalink
Allow accessing fetched entities of a Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
torkleyy committed Nov 22, 2018
1 parent df24334 commit 1a730dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "specs"
version = "0.14.0"
version = "0.14.1"
description = """
Specs is an Entity-Component System library written in Rust.
"""
Expand Down
8 changes: 8 additions & 0 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ where
&self.data.inner
}

/// Returns the `EntitesRes` resource fetched by this storage.
/// **This does not have anything to do with the components inside.**
/// You only want to use this when implementing additional methods
/// for `Storage` via an extension trait.
pub fn fetched_entities(&self) -> &EntitiesRes {
&self.entities
}

/// Tries to read the data associated with an `Entity`.
pub fn get(&self, e: Entity) -> Option<&T> {
if self.data.mask.contains(e.id()) && self.entities.is_alive(e) {
Expand Down

0 comments on commit 1a730dc

Please sign in to comment.