Bläddra i källkod

feat(core): mark `AppHandle::restart` and `process::restart` as diverging functions (#10171)

closes #10160
Amr Bashir 1 år sedan
förälder
incheckning
a7354f9a81
3 ändrade filer med 7 tillägg och 2 borttagningar
  1. 5 0
      .changes/core-restart-fn-diverging.md
  2. 1 1
      core/tauri/src/app.rs
  3. 1 1
      core/tauri/src/process.rs

+ 5 - 0
.changes/core-restart-fn-diverging.md

@@ -0,0 +1,5 @@
+---
+"tauri": "patch:enhance"
+---
+
+Mark `AppHandle::restart` and `process::restart` as [diverging functions](https://doc.rust-lang.org/rust-by-example/fn/diverging.html).

+ 1 - 1
core/tauri/src/app.rs

@@ -417,7 +417,7 @@ impl<R: Runtime> AppHandle<R> {
   }
 
   /// Restarts the app by triggering [`RunEvent::ExitRequested`] with code [`RESTART_EXIT_CODE`] and [`RunEvent::Exit`]..
-  pub fn restart(&self) {
+  pub fn restart(&self) -> ! {
     if self.runtime_handle.request_exit(RESTART_EXIT_CODE).is_err() {
       self.cleanup_before_exit();
     }

+ 1 - 1
core/tauri/src/process.rs

@@ -71,7 +71,7 @@ pub fn current_binary(_env: &Env) -> std::io::Result<PathBuf> {
 ///     Ok(())
 ///   });
 /// ```
-pub fn restart(env: &Env) {
+pub fn restart(env: &Env) -> ! {
   use std::process::{exit, Command};
 
   if let Ok(path) = current_binary(env) {