fix: inline more

This commit is contained in:
əlemi 2024-09-24 04:46:02 +02:00
parent a5befdc481
commit 358586c513
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -14,6 +14,7 @@ macro_rules! auto_into_java {
impl<'j> IntoJava<'j> for $t { impl<'j> IntoJava<'j> for $t {
type Ret = $j; type Ret = $j;
#[inline]
fn into_java(self, _: &mut jni::JNIEnv<'j>) -> Result<Self::Ret, jni::errors::Error> { fn into_java(self, _: &mut jni::JNIEnv<'j>) -> Result<Self::Ret, jni::errors::Error> {
Ok(self) Ok(self)
} }
@ -43,6 +44,7 @@ impl<'j> IntoJava<'j> for bool {
impl<'j, X: IntoJavaObject<'j>> IntoJava<'j> for X { impl<'j, X: IntoJavaObject<'j>> IntoJava<'j> for X {
type Ret = jni::sys::jobject; type Ret = jni::sys::jobject;
#[inline]
fn into_java(self, env: &mut jni::JNIEnv<'j>) -> Result<Self::Ret, jni::errors::Error> { fn into_java(self, env: &mut jni::JNIEnv<'j>) -> Result<Self::Ret, jni::errors::Error> {
Ok(self.into_java_object(env)?.as_raw()) Ok(self.into_java_object(env)?.as_raw())
} }
@ -58,6 +60,7 @@ pub trait IntoJavaObject<'j> {
impl<'j> IntoJavaObject<'j> for JObject<'j> { impl<'j> IntoJavaObject<'j> for JObject<'j> {
const CLASS: &'static str = "java/lang/Object"; const CLASS: &'static str = "java/lang/Object";
#[inline]
fn into_java_object(self, _: &mut jni::JNIEnv<'j>) -> Result<JObject<'j>, jni::errors::Error> { fn into_java_object(self, _: &mut jni::JNIEnv<'j>) -> Result<JObject<'j>, jni::errors::Error> {
Ok(self) Ok(self)
} }
@ -67,6 +70,7 @@ macro_rules! auto_into_java_object {
($t:ty, $cls:literal) => { ($t:ty, $cls:literal) => {
impl<'j> IntoJavaObject<'j> for $t { impl<'j> IntoJavaObject<'j> for $t {
const CLASS: &'static str = $cls; const CLASS: &'static str = $cls;
#[inline]
fn into_java_object(self, _: &mut jni::JNIEnv<'j>) -> Result<JObject<'j>, jni::errors::Error> { fn into_java_object(self, _: &mut jni::JNIEnv<'j>) -> Result<JObject<'j>, jni::errors::Error> {
Ok(self.into()) Ok(self.into())
} }