summaryrefslogtreecommitdiff
path: root/ecs/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/lib.rs')
-rw-r--r--ecs/src/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index fc97d42..5273b67 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -63,6 +63,10 @@ impl World
Self::default()
}
+ /// Creates a new entity with the given components.
+ ///
+ /// # Panics
+ /// Will panic if mutable internal lock cannot be acquired.
pub fn create_entity<Comps>(&mut self, components: Comps)
where
Comps: ComponentSequence,
@@ -122,6 +126,9 @@ impl World
}
/// Peforms the actions that have been queued up using [`Actions`].
+ ///
+ /// # Panics
+ /// Will panic if a mutable internal lock cannot be acquired.
pub fn perform_queued_actions(&self)
{
for action in self
@@ -157,6 +164,10 @@ impl World
}
}
+ /// A event loop which runs until a stop is issued with [`Flags::stop`].
+ ///
+ /// # Panics
+ /// Will panic if a internal lock cannot be acquired.
pub fn event_loop<EventSeq: EventSequence>(&self)
{
let event_seq = EventSeq::ids();
@@ -262,6 +273,7 @@ impl<'world, Comps> Query<'world, Comps>
where
Comps: ComponentSequence,
{
+ #[must_use]
pub fn iter<'this>(&'this self) -> QueryComponentIter<'world, Comps>
where
'this: 'world,
@@ -274,6 +286,7 @@ where
}
/// Returns a weak reference query to the same components.
+ #[must_use]
pub fn to_weak_ref(&self) -> WeakRefQuery<Comps>
{
WeakRefQuery {
@@ -367,6 +380,7 @@ where
/// Returns a struct which can be used to retrieve a [`Query`].
///
/// Returns [`None`] if the [`World`] has been dropped.
+ #[must_use]
pub fn access(&self) -> Option<RefQuery<'_, Comps>>
{
Some(RefQuery {
@@ -404,6 +418,7 @@ impl<'weak_ref, Comps> RefQuery<'weak_ref, Comps>
where
Comps: ComponentSequence,
{
+ #[must_use]
pub fn to_query(&self) -> Query<'_, Comps>
{
Query::new(&self.component_storage)