Skip to content

Commit 7c23720

Browse files
authored
feat: add tauri::version, similar to getTauriVersion available on JS API (#6546)
Signed-off-by: goenning <me@goenning.net> Apply suggestions from code review
1 parent fb485d2 commit 7c23720

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changes/add-tauri-get-version.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": "patch"
3+
---
4+
5+
Added `tauri::version` function to retrieve Tauri's version from Rust.

core/tauri/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ pub trait Runtime: runtime::Runtime<EventLoopMessage> {}
326326

327327
impl<W: runtime::Runtime<EventLoopMessage>> Runtime for W {}
328328

329+
/// Returns Tauri version.
330+
pub fn version() -> &'static str {
331+
env!("CARGO_PKG_VERSION")
332+
}
333+
329334
/// Reads the config file at compile time and generates a [`Context`] based on its content.
330335
///
331336
/// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of

0 commit comments

Comments
 (0)