mod_plugins_resources/
lib.rs1use std::{fmt::Debug, ops::Deref};
2use bevy::prelude::*;
3
4#[derive(Resource, Clone, Debug)]
5pub struct Current<T: Clone + Debug>(T);
6
7impl <T: Clone + Debug> Deref for Current<T> {
9 type Target = T;
10
11 fn deref(&self) -> &Self::Target {
12 &self.0
13 }
14}
15
16impl <T: Clone + Debug> Current<T> {
17 pub fn new(input: T) -> Self { Self(input) }
19
20 pub fn get(&self) -> &T {
22 &self.0
23 }
24
25 pub fn get_mut(&mut self) -> &mut T {
27 &mut self.0
28 }
29
30 pub fn into_inner(self) -> T {
32 self.0
33 }
34}
35
36pub trait Executable<O> {
38 fn execute(self: Box<Self>, world: &mut World) -> O;
39}
40
41#[derive(Component, Default)]
42pub struct ScopeGlobal;
43
44#[derive(Component, Default)]
45pub struct ScopeLocal<S: States + Default>(pub S);