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
38
-
39
-
note that, while possible to pass raw pointers to the JVM, it is not safe by default and must be done with extreme care.
34
+
### Pointers
35
+
Note that, while it is possible to pass raw pointers to the JVM, it is not safe by default and must be done with extreme care.
40
36
41
-
### exceptions
37
+
### Exceptions
42
38
Errors are thrown automatically when a `Result` is an error. For your errors to work, you must implement the `JniToolboxError` trait for your errors,
43
39
(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.
44
-
functions returning `Result`s will automatically have their return value unwrapped and, if is an err, throw an exception and return early.
40
+
41
+
Functions returning `Result`s will automatically have their return value unwrapped and, if is an err, throw an exception and return early.
45
42
46
43
```rust
47
44
implJniToolboxErrorforMyError {
@@ -53,113 +50,75 @@ impl JniToolboxError for MyError {
53
50
54
51
```java
55
52
packagemy.package.some;
56
-
publicclassMyError {
53
+
publicclassMyErrorextendsThrowable{
57
54
publicMyError(Stringx) {
58
55
// TODO
59
56
}
60
57
}
61
58
```
62
59
63
-
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!)
64
-
60
+
To throw simple exceptions, it's possible to use the `exception` attribute. Pass the exception's fully qualified name (must have a constructor
this crate is rather early and intended mostly to maintain [`codemp`](https://github.com/hexedtech/codemp) java bindings, however it's also quite small and only runs at comptime, so should be rather safe to use
121
+
## Status
122
+
This crate is early and intended mostly to maintain [`codemp`](https://github.com/hexedtech/codemp)'s Java bindings, so things not used
123
+
there may be missing or slightly broken. However, the crate is also quite small and only runs at compile time, so trying it out in your
0 commit comments