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
Currently we support returning borrowed slices, which in non-shared-heap backends (Java, Dart, JS, Kotlin) introduce a conversion to their native heap array type.
This works great, except sometimes you just have owned data. We should support returning Box<[u8]> and friends, which converts in non-shared-heap backends, and in shared-heap backends (C++) is either unsupported, also converts, or returns a diplomat-runtime type.
Related potential question: Should diplomat support returning native Rust heap types?
Generally Diplomat tries not to provide target-language wrappers, we provide diplomat::span in C++ as a compatability thing but what we don't do is have an entire library of diplomat specific types that wrap Rust types passed over FFI. Libraries like crubit do this and they should, Diplomat's general attitude here is that if you want such a type you should make your own with exactly the APIs you need.
So, no, unless we can make it a backend attribute transform.
The text was updated successfully, but these errors were encountered:
Note: when implementing this we may need to take care to ensure that returned owned vs static things are handled differently, see #798 for a similar bugfix in Dart.
Currently we support returning borrowed slices, which in non-shared-heap backends (Java, Dart, JS, Kotlin) introduce a conversion to their native heap array type.
This works great, except sometimes you just have owned data. We should support returning
Box<[u8]>
and friends, which converts in non-shared-heap backends, and in shared-heap backends (C++) is either unsupported, also converts, or returns a diplomat-runtime type.Related potential question: Should diplomat support returning native Rust heap types?
Generally Diplomat tries not to provide target-language wrappers, we provide
diplomat::span
in C++ as a compatability thing but what we don't do is have an entire library of diplomat specific types that wrap Rust types passed over FFI. Libraries like crubit do this and they should, Diplomat's general attitude here is that if you want such a type you should make your own with exactly the APIs you need.So, no, unless we can make it a backend attribute transform.
The text was updated successfully, but these errors were encountered: