diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-08 23:30:50 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-08 23:30:50 +0200 |
| commit | 0b78c7da4980c90c2feca1ef7e0ee898db084486 (patch) | |
| tree | ba2f033b004e44b73737e502274117357e022d24 /engine-ecs/src/extension.rs | |
| parent | a34ad021ab4d3330e28e5489b24be7dd23c89808 (diff) | |
feat(engine-ecs): add fns for spawning named entities
Diffstat (limited to 'engine-ecs/src/extension.rs')
| -rw-r--r-- | engine-ecs/src/extension.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/engine-ecs/src/extension.rs b/engine-ecs/src/extension.rs index 1975933..ac989c9 100644 --- a/engine-ecs/src/extension.rs +++ b/engine-ecs/src/extension.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use crate::component::Sequence as ComponentSequence; use crate::entity::Declaration as EntityDeclaration; use crate::sole::Sole; @@ -53,6 +55,17 @@ impl<'world> Collector<'world> self.world.spawn(components); } + /// Adds a entity to the [`World`]. + pub fn spawn_named<Comps>( + &mut self, + name: impl Into<Cow<'static, str>>, + components: Comps, + ) where + Comps: ComponentSequence, + { + self.world.spawn_named(name, components); + } + /// Adds a declared entity to the [`World`]. pub fn spawn_declared_entity(&mut self, entity_decl: &EntityDeclaration) { |
