diff options
Diffstat (limited to 'mingling_core/src/program/setup.rs')
| -rw-r--r-- | mingling_core/src/program/setup.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mingling_core/src/program/setup.rs b/mingling_core/src/program/setup.rs index e81247e..1f16f80 100644 --- a/mingling_core/src/program/setup.rs +++ b/mingling_core/src/program/setup.rs @@ -1,18 +1,25 @@ +use std::fmt::Display; + use crate::{ProgramCollect, program::Program}; mod basic; pub use basic::*; -pub trait ProgramSetup<C: ProgramCollect> { - fn setup(&mut self, program: &mut Program<C>); +pub trait ProgramSetup<C, G> +where + C: ProgramCollect, + G: Display, +{ + fn setup(&mut self, program: &mut Program<C, G>); } -impl<C> Program<C> +impl<C, G> Program<C, G> where C: ProgramCollect, + G: Display, { /// Load and execute init logic - pub fn with_setup<S: ProgramSetup<C> + 'static>(&mut self, mut setup: S) -> S { + pub fn with_setup<S: ProgramSetup<C, G> + 'static>(&mut self, mut setup: S) -> S { S::setup(&mut setup, self); setup } |
