Recently I wanted to remove .run()
usage from my app, but I found that I can’t do this since I already take value from response and return it to other function.
My code before conversion looks that:
fn check_user_input() -> bool {
let dialog = dialog::new();
let response = dialog.run();
if response == RESPONSE_OK{
return true;
}
return false;
}
and I want to convert this to something like
fn check_user_input() -> bool {
let dialog = dialog::new();
dialog.connect_response(|dialog, response|{
if response == RESPONSE_OK{
return true; // This will fail because closure return ()(void, nothing)
}
return false;
});
// Compile error, function must return bool
}