mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 07:14:50 +01:00
chore(java): added glue for version method
This commit is contained in:
parent
0ffcef360b
commit
e0ea884b53
3 changed files with 15 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -33,3 +33,4 @@ dist/java/bin/
|
||||||
dist/java/gradle/
|
dist/java/gradle/
|
||||||
dist/java/gradlew
|
dist/java/gradlew
|
||||||
dist/java/gradlew.bat
|
dist/java/gradlew.bat
|
||||||
|
dist/java/.factorypath
|
||||||
|
|
8
dist/java/src/mp/code/Extensions.java
vendored
8
dist/java/src/mp/code/Extensions.java
vendored
|
@ -12,7 +12,13 @@ public final class Extensions {
|
||||||
static final Cleaner CLEANER = Cleaner.create();
|
static final Cleaner CLEANER = Cleaner.create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hashes the given {@link String} using CodeMP's hashing algorithm (xxh3).
|
* Returns the version of the Rust crate as a String.
|
||||||
|
* @return the current version
|
||||||
|
*/
|
||||||
|
public static native String version();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hashes the given String using CodeMP's hashing algorithm (xxh3).
|
||||||
* @param input the string to hash
|
* @param input the string to hash
|
||||||
* @return the hash
|
* @return the hash
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
use jni_toolbox::jni;
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
/// Calculate the XXH3 hash for a given String.
|
/// Calculate the XXH3 hash for a given String.
|
||||||
#[jni(package = "mp.code", class = "Extensions")]
|
#[jni(package = "mp.code", class = "Extensions")]
|
||||||
fn hash(content: String) -> i64 {
|
fn hash(content: String) -> i64 {
|
||||||
|
|
Loading…
Reference in a new issue