diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-01 12:55:23 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-01 12:55:23 +0800 |
| commit | 1ab19e8765ea2ed62c8a41113d84867facaabf08 (patch) | |
| tree | 1c81d759d195daf0275b031929292573f2b483fd /mingling_core | |
| parent | 94baeaca074dd8b12d16180119cac09f453c5e85 (diff) | |
Change `ProgramSetup::setup` to consume `self` instead of borrow
Diffstat (limited to 'mingling_core')
| -rw-r--r-- | mingling_core/src/program/setup.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mingling_core/src/program/setup.rs b/mingling_core/src/program/setup.rs index 0fe8070..fa9d0eb 100644 --- a/mingling_core/src/program/setup.rs +++ b/mingling_core/src/program/setup.rs @@ -4,7 +4,7 @@ pub trait ProgramSetup<C> where C: ProgramCollect<Enum = C>, { - fn setup(&mut self, program: &mut Program<C>); + fn setup(self, program: &mut Program<C>); } impl<C> Program<C> @@ -12,8 +12,7 @@ where C: ProgramCollect<Enum = C>, { /// 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 + pub fn with_setup<S: ProgramSetup<C> + 'static>(&mut self, setup: S) { + S::setup(setup, self); } } |
