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`]
|
/// Applies [`widget::Operation`]s to the [`State`]
|
||||||
pub fn operate<'a>(
|
pub fn operate(
|
||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut P::Renderer,
|
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,
|
bounds: Size,
|
||||||
debug: &mut Debug,
|
debug: &mut Debug,
|
||||||
) {
|
) {
|
||||||
|
|
@ -192,18 +192,18 @@ where
|
||||||
);
|
);
|
||||||
|
|
||||||
for operation in operations {
|
for operation in operations {
|
||||||
let mut owned_op;
|
|
||||||
let mut current_operation = Some(operation);
|
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() {
|
match operation.finish() {
|
||||||
Outcome::None => {}
|
Outcome::None => {}
|
||||||
Outcome::Some(message) => {
|
Outcome::Some(message) => {
|
||||||
self.queued_messages.push(message)
|
self.queued_messages.push(message)
|
||||||
}
|
}
|
||||||
Outcome::Chain(op) => {
|
Outcome::Chain(next) => {
|
||||||
owned_op = op;
|
current_operation = Some(next);
|
||||||
current_operation = Some(owned_op.as_mut());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue