From 97f973d685baf389dcde08044dd3dfb7ba556050 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 6 Apr 2024 14:17:30 +0200 Subject: refactor(ecs): fix Clippy lints --- ecs/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ecs/src/lib.rs') 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(&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(&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 { 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> { 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) -- cgit v1.2.3-18-g5258