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
parsing of java-api-for-rust: src/generated/java_glue.rs.in failed
error: Do not know conversion from such rust type '& NeuralNetwork' to Java type
getScore = GetScoreCallback::get_score(& mut self , network : & NeuralNetwork)->f64;
However, when I am using references wtih class method - it works:
Is there any way to solve this problem without copying?
You can copy, but use something like std::sync::Arc for this to make it cheap.
The problem is that in callback you call Java code from Rust.
So there is need to pass reference to Rust object to Java with restricted lifetime.
But Java has no such thing as reference with restrited lifetime.
So I can no see how to create "safe" way to do it.
For example If flapigen generates Java class like NeuralNetworkReference,
how can anybody prevent situation, when Java side user save object of type NeuralNetworkReference, somewhere and try to reuse it later?
That's why default binding require to pass ownership to Java side.
When I am trying to create callback with pointers, flapigen cannot convert &Type to java:
rust code:
generated interface:
error:
However, when I am using references wtih class method - it works:
Copying network is a compute-intense process.
Is there any way to solve this problem without copying?
The text was updated successfully, but these errors were encountered: