diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-29 00:52:16 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-29 00:52:28 +0800 |
| commit | db9afa0b06355028eafe3bc29fe0b2429ba8fd0a (patch) | |
| tree | 60bf74d0853fcc0c1e9363813c26109a6ca38a4f /mingling/src/program/setup.rs | |
| parent | 7ce68cd11516bd7cf037ecea99a92aee7c31b2c3 (diff) | |
Completed the first preliminary usable version of the Mingling
framework.
Diffstat (limited to 'mingling/src/program/setup.rs')
| -rw-r--r-- | mingling/src/program/setup.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mingling/src/program/setup.rs b/mingling/src/program/setup.rs index fdf7b04..e81247e 100644 --- a/mingling/src/program/setup.rs +++ b/mingling/src/program/setup.rs @@ -1,15 +1,19 @@ -use crate::program::Program; +use crate::{ProgramCollect, program::Program}; mod basic; pub use basic::*; -pub trait ProgramSetup { - fn setup(program: &mut Program); +pub trait ProgramSetup<C: ProgramCollect> { + fn setup(&mut self, program: &mut Program<C>); } -impl Program { +impl<C> Program<C> +where + C: ProgramCollect, +{ /// Load and execute init logic - pub fn with_setup<S: ProgramSetup + 'static>(&mut self, _setup: S) { - S::setup(self); + pub fn with_setup<S: ProgramSetup<C> + 'static>(&mut self, mut setup: S) -> S { + S::setup(&mut setup, self); + setup } } |
