Take Box instead of reference in State::operate
This commit is contained in:
parent
4b831a917d
commit
ae2709f2c4
1 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue