فهرست منبع

feat: add `tauri::version`, similar to `getTauriVersion` available on JS API (#6546)

Signed-off-by: goenning <me@goenning.net>

Apply suggestions from code review
Guilherme Oenning 2 سال پیش
والد
کامیت
7c23720920
2فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 5 0
      .changes/add-tauri-get-version.md
  2. 5 0
      core/tauri/src/lib.rs

+ 5 - 0
.changes/add-tauri-get-version.md

@@ -0,0 +1,5 @@
+---
+"tauri": "patch"
+---
+
+Added `tauri::version` function to retrieve Tauri's version from Rust.

+ 5 - 0
core/tauri/src/lib.rs

@@ -326,6 +326,11 @@ pub trait Runtime: runtime::Runtime<EventLoopMessage> {}
 
 impl<W: runtime::Runtime<EventLoopMessage>> Runtime for W {}
 
+/// Returns Tauri version.
+pub fn version() -> &'static str {
+  env!("CARGO_PKG_VERSION")
+}
+
 /// Reads the config file at compile time and generates a [`Context`] based on its content.
 ///
 /// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of