Open CBenoit opened 2 years ago
We should also probably force them to be Copy
.
Ideally it would be nice to support non opaque structs containing opaque ones but that might be tricky?
We might be okay having non-Copy ones for returning but not for accepting by-move, so actually this might just be another validity check to install.
Ideally it would be nice to support non opaque structs containing opaque ones but that might be tricky?
I guess it's doable in C++ (by wrapping these with std::unique_ptr
). In GC-based languages it will be pretty tricky (for idiomatic C# wrappers, I'm not even quite sure how to proceed with non-opaque structs containing non-opaque structs yet).
I guess it's doable in C++ (by wrapping these with
std::unique_ptr
). In GC-based languages it will be pretty tricky (for idiomatic C# wrappers, I'm not even quite sure how to proceed with non-opaque structs containing non-opaque structs yet).
Yeah precisely my concern.
I think this is where the distinction between inputs and outputs comes: we're fine with structs being returned that contain (mostly) anything, but it's trickier to accept structs doing so.
Basically, input types should not have:
but output types can have all of those except the first.
Non-opaque structs should not have custom Drop implementation and are always passed by-copy. These should be trivially destructible. As such,
*_destroy
symbols for these custom types should not be emitted._Originally posted by @Manishearth in https://github.com/rust-diplomat/diplomat/pull/124#discussion_r795130198_