closure
--> services/src/web_service.rs:43:49
|
41 | let clone = self.r.clone();
| ----- captured outer variable
42 | HttpServer::new(move || {
43 | App::with_state(AppState { counter: clone })
| ^^^^^ cannot move out of captured variable in an `Fn` closure
error[E0507]: cannot move out of `clone`, as it is a captured variable in a `Fn` closure
--> services/src/web_service.rs:43:49
|
43 | App::with_state(AppState { counter: clone })
| ^^^^^
| |
| cannot move out of `clone`, as it is a captured variable in a `Fn` closure
| cannot move
|
help: consider changing this to accept closures that implement `FnMut`
--> services/src/web_service.rs:42:25
|
42 | HttpServer::new(move || {
| _________________________^
43 | | App::with_state(AppState { counter: clone })
44 | | .resource("/", |r| r.method(Method::GET).f(index))
45 | | })
| |_________^
пробовал с move и без, идей ноль
Попробуй clone.clone()
Обсуждают сегодня