blob: 1f16f806d464dae15385275554a2faf7a223b0f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use std::fmt::Display;
use crate::{ProgramCollect, program::Program};
mod basic;
pub use basic::*;
pub trait ProgramSetup<C, G>
where
C: ProgramCollect,
G: Display,
{
fn setup(&mut self, program: &mut Program<C, G>);
}
impl<C, G> Program<C, G>
where
C: ProgramCollect,
G: Display,
{
/// Load and execute init logic
pub fn with_setup<S: ProgramSetup<C, G> + 'static>(&mut self, mut setup: S) -> S {
S::setup(&mut setup, self);
setup
}
}
|