Consider the following Situation:
I have a rust-crate and corresponding JuliaPackage that use jlrs lets call this package jlrs-foo it exports an OpaqueType.
| crate |
julia-package |
| jlrs-foo |
JlrsFoo |
| just-type |
julia-type |
| jlrs_foo::Foo |
JlrsFoo.Foo |
Now there is a second jlrs Package that depends on jlrs-foo, it has its own types, but also wants to have some function that actually return the type Foo from jlrs-foo. Lets call this package jlrs-bar
Here is what I have tried jlrs-bar/src/lib.rs:
use jlrs::prelude::*;
use jlrs_foo::Foo;
julia_module! {
struct Foo;
fn get_foo() -> TypedValueRet<Foo> as jlrsbar_get_foo();
}
But this leads to the situation that I now have two forein types that are from rusts perspective the same type, but not from Julias perspective:
| just-type |
julia-type |
| jlrs_foo::Foo |
JlrsFoo.Foo |
| jlrs_foo:Foo |
JlrsBar.Foo |
Since Julia is strongly typed I can not just convert one into the other. I have tried to do that a few different ways, always ending up in a julia error. This is annoying, because I can not just use the value of jlrsbar_get_foo like and other value of type Foo when it is constructed in JlrsFoo.
I have also tried not exporting the type in jlrs-bar and instead try to return ValueRet instead of TypedValueRef<Foo>, but this just leads me down into core dump situations.
Any Ideas how to solve/deal with this Situation?
Consider the following Situation:
I have a rust-crate and corresponding JuliaPackage that use
jlrslets call this packagejlrs-fooit exports an OpaqueType.Now there is a second jlrs Package that depends on
jlrs-foo, it has its own types, but also wants to have some function that actually return the typeFoofromjlrs-foo. Lets call this packagejlrs-barHere is what I have tried
jlrs-bar/src/lib.rs:But this leads to the situation that I now have two forein types that are from rusts perspective the same type, but not from Julias perspective:
Since Julia is strongly typed I can not just convert one into the other. I have tried to do that a few different ways, always ending up in a julia error. This is annoying, because I can not just use the value of
jlrsbar_get_foolike and other value of typeFoowhen it is constructed inJlrsFoo.I have also tried not exporting the type in
jlrs-barand instead try to returnValueRetinstead ofTypedValueRef<Foo>, but this just leads me down into core dump situations.Any Ideas how to solve/deal with this Situation?