will_umount method in Activity

This commit is contained in:
veeso
2021-03-21 17:16:52 +01:00
parent 30c2aa144b
commit f0d87ff8c4
9 changed files with 95 additions and 50 deletions

View File

@@ -33,7 +33,16 @@ pub mod auth_activity;
pub mod filetransfer_activity;
pub mod setup_activity;
// Activity trait
// -- Exit reason
pub enum ExitReason {
Quit,
Connect,
Disconnect,
EnterSetup,
}
// -- Activity trait
pub trait Activity {
/// ### on_create
@@ -49,6 +58,13 @@ pub trait Activity {
/// This function must be called at each tick to refresh the interface
fn on_draw(&mut self);
/// ### will_umount
///
/// `will_umount` is the method which must be able to report to the activity manager, whether
/// the activity should be terminated or not.
/// If not, the call will return `None`, otherwise return`Some(ExitReason)`
fn will_umount(&self) -> Option<&ExitReason>;
/// ### on_destroy
///
/// `on_destroy` is the function which cleans up runtime variables and data before terminating the activity.