You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiler output for the two functions above where it does not work:
--> src/lib.rs:125:41
|
125 | .test_with_string_array(vec![String::from("Some signature")])
| ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `duchess::JvmOp` is not implemented for `Vec<std::string::String>`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `duchess::JvmOp`:
bool
char
i8
i16
i32
i64
u16
f32
and 192 others
= note: required for `Vec<std::string::String>` to implement `duchess::IntoJava<Array<duchess::java::lang::String>>`
note: required by a bound in `ViewAsKerenDemoObj::<J, N>::test_with_string_array`
--> src/lib.rs:14:1
|
14 | / duchess::java_package! {
15 | | package demo;
16 | |
17 | | class KerenDemo { * }
18 | | class StringListRecord { * }
20 | | }
| |_^ required by this bound in `ViewAsKerenDemoObj::<J, N>::test_with_string_array`
= note: this error originates in the macro `duchess::java_package` (in Nightly builds, run with -Z macro-backtrace for more info)
The text was updated successfully, but these errors were encountered:
On Mon, Jul 15, 2024, at 5:57 PM, Niko Matsakis wrote:
So, the short version is that you ought to call `.to_java` for the arguments to convert them into Java:
pub fn does_not_work (self: Arc<Self>) {
tokio::task::spawn_blocking(move || {
duchess::Jvm::attach_thread_permanently().unwrap();
self.client
.test_with_string_list(vec!["Some signature".into()].to_java()) // <--
.execute()
.unwrap();
});
}
Does that work?
—
Reply to this email directly, view it on GitHub <#122 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABF4ZVYDRKZMO7NKIP6C43ZMRAWPAVCNFSM6AAAAABK5LR5KGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRZGUYDQMJSGQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Hi!
Creating this ticket to track using
Vec
<->List
/ArrayList
for function parameters.Expectation: I can pass in a list of arguments (of any type) to a Java function via Duchess
Current: I can pass in a
Vec<T>
to a Rust function if it is a parameter for aJava Record
. I cannot passVec<T>
directly as parameters.See code below for reproduction.
See compiler output for what I'm seeing for the two cases:
test_with_string_array
andtest_with_string_list
.Java side:
Rust Side:
Compiler output for the two functions above where it does not work:
The text was updated successfully, but these errors were encountered: