Skip to content

Commit 3f86d70

Browse files
committed
Rename Argument -> Arg
1 parent dbe5f22 commit 3f86d70

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎java-spaghetti/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ pub use ::std;
1313

1414
mod refs {
1515

16-
mod argument;
16+
mod arg;
1717
mod global;
1818
mod local;
1919
mod ref_;
2020

21-
pub use argument::*;
21+
pub use arg::*;
2222
pub use global::*;
2323
pub use local::*;
2424
pub use ref_::*;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ use jni_sys::*;
44

55
use crate::{Env, Global, Local, Ref, ReferenceType};
66

7-
/// FFI: Use **Argument\<java::lang::Object\>** instead of jobject. This represents a (null?) function argument.
7+
/// FFI: Use **Arg\<java::lang::Object\>** instead of jobject. This represents a (null?) function argument.
88
///
99
/// Unlike most Java reference types from this library, this *can* be null.
1010
///
1111
/// FFI safe where a jobject is safe, assuming you match your types correctly. Using the wrong type may result in
1212
/// soundness issues, but at least on Android mostly seems to just result in JNI aborting execution for the current
1313
/// process when calling methods on an instance of the wrong type.
1414
#[repr(transparent)]
15-
pub struct Argument<T: ReferenceType> {
15+
pub struct Arg<T: ReferenceType> {
1616
object: jobject,
1717
_class: PhantomData<T>,
1818
}
1919

20-
impl<T: ReferenceType> Argument<T> {
20+
impl<T: ReferenceType> Arg<T> {
2121
/// **unsafe**: There's no guarantee the jobject being passed is valid or null, nor any means of checking it.
2222
pub unsafe fn from_raw(object: jobject) -> Self {
2323
Self {
@@ -31,7 +31,7 @@ impl<T: ReferenceType> Argument<T> {
3131
}
3232

3333
/// **unsafe**: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the
34-
/// intended use case of immediately converting any Argument s into ArgumentRef s at the start of a JNI callback,
34+
/// intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback,
3535
/// where Java directly invoked your function with an Env + arguments, is sound.
3636
pub unsafe fn into_ref<'env>(self, env: Env<'env>) -> Option<Ref<'env, T>> {
3737
if self.object.is_null() {
@@ -42,7 +42,7 @@ impl<T: ReferenceType> Argument<T> {
4242
}
4343

4444
/// **unsafe**: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the
45-
/// intended use case of immediately converting any Argument s into ArgumentRef s at the start of a JNI callback,
45+
/// intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback,
4646
/// where Java directly invoked your function with an Env + arguments, is sound.
4747
pub unsafe fn into_local<'env>(self, env: Env<'env>) -> Option<Local<'env, T>> {
4848
if self.object.is_null() {
@@ -53,7 +53,7 @@ impl<T: ReferenceType> Argument<T> {
5353
}
5454

5555
/// **unsafe**: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the
56-
/// intended use case of immediately converting any Argument s into ArgumentRef s at the start of a JNI callback,
56+
/// intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback,
5757
/// where Java directly invoked your function with an Env + arguments, is sound.
5858
pub unsafe fn into_global(self, env: Env) -> Option<Global<T>> {
5959
if self.object.is_null() {

‎java-spaghetti/src/refs/ref_.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use jni_sys::jobject;
77
use crate::{Env, Global, Local, ObjectAndEnv, ReferenceType};
88

99
/// A non-null, [reference](https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/jni_refs.html)
10-
/// to a Java object (+ [Env]). This may refer to a [Local](crate::Local), [Global](crate::Global), local [Argument](crate::Argument), etc.
10+
/// to a Java object (+ [Env]). This may refer to a [Local](crate::Local), [Global](crate::Global), local [Arg](crate::Arg), etc.
1111
///
1212
/// **Not FFI Safe:** #\[repr(rust)\], and exact layout is likely to change - depending on exact features used - in the
1313
/// future. Specifically, on Android, since we're guaranteed to only have a single ambient VM, we can likely store the

0 commit comments

Comments
 (0)