diff options
author | 2024-06-20 01:23:01 +0200 | |
---|---|---|
committer | 2024-06-20 01:23:01 +0200 | |
commit | 714d4503154a6224c26f2eed6e399c73d57b4bf8 (patch) | |
tree | 9456eb2d40f2761c29dfa51f370efe11dc22f5e5 /runtime/src/lib.rs | |
parent | 19db068bbbebcda1756720525da247f35bd3a5e0 (diff) | |
parent | c5f4bebeda8d6ef10efade7933a5ee58f06b62d1 (diff) | |
download | iced-714d4503154a6224c26f2eed6e399c73d57b4bf8.tar.gz iced-714d4503154a6224c26f2eed6e399c73d57b4bf8.tar.bz2 iced-714d4503154a6224c26f2eed6e399c73d57b4bf8.zip |
Merge pull request #2469 from iced-rs/unify-shell-runtimes
`Daemon` API and Shell Runtime Unification
Diffstat (limited to 'runtime/src/lib.rs')
-rw-r--r-- | runtime/src/lib.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 5fde3039..b4a5e819 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -70,6 +70,12 @@ pub enum Action<T> { /// Run a system action. System(system::Action), + + /// Exits the runtime. + /// + /// This will normally close any application windows and + /// terminate the runtime loop. + Exit, } impl<T> Action<T> { @@ -88,6 +94,7 @@ impl<T> Action<T> { Action::Clipboard(action) => Err(Action::Clipboard(action)), Action::Window(action) => Err(Action::Window(action)), Action::System(action) => Err(Action::System(action)), + Action::Exit => Err(Action::Exit), } } } @@ -110,6 +117,15 @@ where } Action::Window(_) => write!(f, "Action::Window"), Action::System(action) => write!(f, "Action::System({action:?})"), + Action::Exit => write!(f, "Action::Exit"), } } } + +/// Creates a [`Task`] that exits the iced runtime. +/// +/// This will normally close any application windows and +/// terminate the runtime loop. +pub fn exit<T>() -> Task<T> { + Task::effect(Action::Exit) +} |