diff options
Diffstat (limited to 'mingling_core/src/program/setup.rs')
| -rw-r--r-- | mingling_core/src/program/setup.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mingling_core/src/program/setup.rs b/mingling_core/src/program/setup.rs new file mode 100644 index 0000000..e81247e --- /dev/null +++ b/mingling_core/src/program/setup.rs @@ -0,0 +1,19 @@ +use crate::{ProgramCollect, program::Program}; + +mod basic; +pub use basic::*; + +pub trait ProgramSetup<C: ProgramCollect> { + fn setup(&mut self, program: &mut Program<C>); +} + +impl<C> Program<C> +where + C: ProgramCollect, +{ + /// Load and execute init logic + pub fn with_setup<S: ProgramSetup<C> + 'static>(&mut self, mut setup: S) -> S { + S::setup(&mut setup, self); + setup + } +} |
