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
to return pointer type values, add the `ptr` attribute
33
+
34
+
note that, while possible to pass raw pointers to the JVM, it is not safe by default and must be done with extreme care.
35
+
36
+
### exceptions
21
37
Errors are thrown automatically when a `Result` is an error. For your errors to work, you must implement the `JniToolboxError` trait for your errors,
22
38
(which just returns the path to your Java error class) and then make a Java error wrapper which can be constructed with a single string argument.
23
39
functions returning `Result`s will automatically have their return value unwrapped and, if is an err, throw an exception and return early.
24
40
41
+
```rust
42
+
implJniToolboxErrorforMyError {
43
+
fnjclass(&self) ->String {
44
+
"my/package/some/MyError".to_string()
45
+
}
46
+
}
47
+
```
48
+
49
+
```java
50
+
packagemy.package.some;
51
+
publicclassMyError {
52
+
publicMyError(Stringx) {
53
+
// TODO
54
+
}
55
+
}
56
+
```
57
+
25
58
to throw simple exceptions, it's possible to use the `exception` attribute. just pass your exception's path (must be constructable with a single string argument!)
26
59
27
-
to return pointer type values, add the `ptr` attribute
0 commit comments