Merge pull request #46 from hexedtech/fix/static-version

fix: js, py and lua allow &'static str, use it
This commit is contained in:
zaaarf 2024-10-13 19:24:38 +02:00 committed by GitHub
commit 0aebf2d8d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View file

@ -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()

View file

@ -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()
}

View file

@ -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

View file

@ -133,8 +133,8 @@ impl Driver {
}
#[pyfunction]
fn version() -> String {
crate::version().to_string()
fn version() -> &'static str {
crate::version()
}
#[pyfunction]