Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:/Users/user/.cargo/bin/cargo.exe run --package mvc --bin mvc
- Compiling mvc v0.1.0 (file:///C:/Users/user/Documents/rust/mvc)
- error[E0495]: cannot infer an appropriate lifetime for capture of `self` by closure due to conflicting requirements
- --> src\presenter.rs:12:24
- |
- 12 | let callback = ||{
- | ________________________^
- 13 | | self.login(&String::from("123"), &String::from("123"));
- 14 | | };
- | |_____________________^
- |
- note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 9:5...
- --> src\presenter.rs:9:5
- |
- 9 | / pub fn register(&mut self, view: Box<ViewT>, service: Box<LoginService>) {
- 10 | | self._view = Some(view);
- 11 | | self._service = Some(service);
- 12 | | let callback = ||{
- ... |
- 21 | | }
- 22 | | }
- | |_____^
- note: ...so that the reference type `&&mut presenter::LoginPresenter<ViewT>` does not outlive the data it points at
- --> src\presenter.rs:18:17
- |
- 18 | v.set_login_callback(callback);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: but, the lifetime must be valid for the static lifetime...
- note: ...so that the type `[closure@src\presenter.rs:12:24: 14:22 self:&&mut presenter::LoginPresenter<ViewT>]` will meet its required lifetime bounds
- --> src\presenter.rs:18:19
- |
- 18 | v.set_login_callback(callback);
- | ^^^^^^^^^^^^^^^^^^
- error[E0477]: the type `[closure@src\presenter.rs:12:24: 14:22 self:&&mut presenter::LoginPresenter<ViewT>]` does not fulfill the required lifetime
- --> src\presenter.rs:18:19
- |
- 18 | v.set_login_callback(callback);
- | ^^^^^^^^^^^^^^^^^^
- |
- = note: type must satisfy the static lifetime
- error: aborting due to 2 previous errors
- error: Could not compile `mvc`.
- To learn more, run the command again with --verbose.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement