mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 07:14:50 +01:00
Merge pull request #46 from hexedtech/fix/static-version
fix: js, py and lua allow &'static str, use it
This commit is contained in:
commit
0aebf2d8d9
4 changed files with 5 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
use jni_toolbox::jni;
|
use jni_toolbox::jni;
|
||||||
|
|
||||||
/// Gets the current version of the Rust crate.
|
/// Gets the current version of the Rust crate.
|
||||||
#[allow(non_snake_case)]
|
|
||||||
#[jni(package = "mp.code", class = "Extensions")]
|
#[jni(package = "mp.code", class = "Extensions")]
|
||||||
fn version() -> String {
|
fn version() -> String {
|
||||||
crate::version().to_string()
|
crate::version().to_string()
|
||||||
|
|
|
@ -8,6 +8,6 @@ pub fn js_hash(data: String) -> i64 {
|
||||||
|
|
||||||
/// Get the current version of the client
|
/// Get the current version of the client
|
||||||
#[napi(js_name = "version")]
|
#[napi(js_name = "version")]
|
||||||
pub fn js_version() -> String {
|
pub fn js_version() -> &'static str {
|
||||||
crate::version().to_string()
|
crate::version()
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ fn entrypoint(lua: &Lua) -> LuaResult<LuaTable> {
|
||||||
|
|
||||||
exports.set(
|
exports.set(
|
||||||
"version",
|
"version",
|
||||||
lua.create_function(|_, ()| Ok(crate::version().to_string()))?,
|
lua.create_function(|_, ()| Ok(crate::version()))?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// runtime
|
// runtime
|
||||||
|
|
|
@ -133,8 +133,8 @@ impl Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn version() -> String {
|
fn version() -> &'static str {
|
||||||
crate::version().to_string()
|
crate::version()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
|
|
Loading…
Reference in a new issue