From 04fb8519f624541b68e5cfe84fb878dc180a49fe Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Wed, 27 Aug 2025 13:34:31 -0500 Subject: [PATCH] Trait `SpawnUi` for things that can spawn a UI I don't want to copy-paste a bunch of code, so I'm going to get the compiler to do it for me. --- src/widgets/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index 7cc33b7..dc14924 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -28,6 +28,14 @@ impl Plugin for GameUiPlugin { } } +/// Anything that can spawn a themed UI should impl this trait. +/// +/// This exists mainly so that I can write generic functions and have the *compiler* +/// expand the code for me, instead of doing it by hand. +pub trait SpawnUi { + fn spawn_ui(commands: Commands, theme: Res); +} + /// The base panel for the machines that manipulate the room cards. /// /// This function is not a valid Bevy System because of how the Commands struct