diff options
author | 2023-06-29 08:14:44 +0200 | |
---|---|---|
committer | 2023-06-29 08:14:44 +0200 | |
commit | ae2709f2c4ce30b2006471ef23589e12f41c9a80 (patch) | |
tree | 96efe09711678457938d975dd4135bd25df5766b /runtime/src | |
parent | 4b831a917d81def2320a5910ea8975acb2baaaf1 (diff) | |
download | iced-ae2709f2c4ce30b2006471ef23589e12f41c9a80.tar.gz iced-ae2709f2c4ce30b2006471ef23589e12f41c9a80.tar.bz2 iced-ae2709f2c4ce30b2006471ef23589e12f41c9a80.zip |
Take `Box` instead of reference in `State::operate`
Diffstat (limited to 'runtime/src')
-rw-r--r-- | runtime/src/program/state.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/runtime/src/program/state.rs b/runtime/src/program/state.rs index f57d2d8d..9ae504ee 100644 --- a/runtime/src/program/state.rs +++ b/runtime/src/program/state.rs @@ -176,10 +176,10 @@ where } /// Applies [`widget::Operation`]s to the [`State`] - pub fn operate<'a>( + pub fn operate( &mut self, renderer: &mut P::Renderer, - operations: impl Iterator<Item = &'a mut dyn Operation<P::Message>>, + operations: impl Iterator<Item = Box<dyn Operation<P::Message>>>, bounds: Size, debug: &mut Debug, ) { @@ -192,18 +192,18 @@ where ); for operation in operations { - let mut owned_op; let mut current_operation = Some(operation); - while let Some(operation) = current_operation.take() { - user_interface.operate(renderer, operation); + + while let Some(mut operation) = current_operation.take() { + user_interface.operate(renderer, operation.as_mut()); + match operation.finish() { Outcome::None => {} Outcome::Some(message) => { self.queued_messages.push(message) } - Outcome::Chain(op) => { - owned_op = op; - current_operation = Some(owned_op.as_mut()); + Outcome::Chain(next) => { + current_operation = Some(next); } }; } |