Open
Description
We have a few traits that users has to implement manually, namely Encode
, RefEncode
, Message
and the INS...
traits. It would be nice if these could be automatically derive
d, but in essence we can't allow that because they are unsafe
, and a derive
macro wouldn't be able to uphold the required safety invariants.
#[derive(Encode)]
(requested upstream in SSheldon/rust-objc#52) specifically doesn't work because the user could create a #[repr(C)]
struct which used e.g. [i8; 4]
while the Objective-C side used int
. Or *const u8
vs. c_void*
; this is valid from a normal FFI-perspective, but Encode
requires that the encodings match perfectly.
So I'm actually probably going to remove the existing objc2_foundation_derive
helpers in this repo.