-
Notifications
You must be signed in to change notification settings - Fork 69
derive macros #55
Copy link
Copy link
Open
Labels
A-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesdocumentationImprovements or additions to documentationImprovements or additions to documentation
Metadata
Metadata
Assignees
Labels
A-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesdocumentationImprovements or additions to documentationImprovements or additions to documentation
We have a few traits that users has to implement manually, namely
Encode,RefEncode,Messageand theINS...traits. It would be nice if these could be automaticallyderived, but in essence we can't allow that because they areunsafe, and aderivemacro 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 usedint. Or*const u8vs.c_void*; this is valid from a normal FFI-perspective, butEncoderequires that the encodings match perfectly.So I'm actually probably going to remove the existing
objc2_foundation_derivehelpers in this repo.