Skip to content

Commit

Permalink
fix: js, py and lua allow &'static str, use it
Browse files Browse the repository at this point in the history
  • Loading branch information
alemidev committed Oct 13, 2024
1 parent 6dedb5f commit 504a5c0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/ffi/java/ext.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use jni_toolbox::jni;

/// Gets the current version of the Rust crate.
#[allow(non_snake_case)]
#[jni(package = "mp.code", class = "Extensions")]
fn version() -> String {
crate::version().to_string()
Expand Down
4 changes: 2 additions & 2 deletions src/ffi/js/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ pub fn js_hash(data: String) -> i64 {

/// Get the current version of the client
#[napi(js_name = "version")]
pub fn js_version() -> String {
crate::version().to_string()
pub fn js_version() -> &'static str {
crate::version()
}
2 changes: 1 addition & 1 deletion src/ffi/lua/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn entrypoint(lua: &Lua) -> LuaResult<LuaTable> {

exports.set(
"version",
lua.create_function(|_, ()| Ok(crate::version().to_string()))?,
lua.create_function(|_, ()| Ok(crate::version()))?,
)?;

// runtime
Expand Down
4 changes: 2 additions & 2 deletions src/ffi/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ impl Driver {
}

#[pyfunction]
fn version() -> String {
crate::version().to_string()
fn version() -> &'static str {
crate::version()
}

#[pyfunction]
Expand Down

0 comments on commit 504a5c0

Please sign in to comment.