summaryrefslogtreecommitdiff
path: root/ecs/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-06 14:17:30 +0200
committerHampusM <hampus@hampusmat.com>2024-04-06 14:17:30 +0200
commit97f973d685baf389dcde08044dd3dfb7ba556050 (patch)
tree63e67bf212aabd653b5344fd773212e11afd4ae9 /ecs/src/lib.rs
parent407612918489bfa642e2d653edbb54272b3f00f5 (diff)
refactor(ecs): fix Clippy lints
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)