-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
derive
macros
#55
Comments
And my personal take: I really dislike the extra compilation cost and the complexity in implementing them; I'd any day rather use |
|
I'm finding, when converting huge amounts of code, that derived |
We could maybe also add a unsafe impl objc::Encode for T {
#[inline]
fn encode() -> objc::Encoding {
objc::Encoding::from_str(T::ENCODING)
}
} |
We have a few traits that users has to implement manually, namely
Encode
,RefEncode
,Message
and theINS...
traits. It would be nice if these could be automaticallyderive
d, but in essence we can't allow that because they areunsafe
, and aderive
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 usedint
. Or*const u8
vs.c_void*
; this is valid from a normal FFI-perspective, butEncode
requires that the encodings match perfectly.So I'm actually probably going to remove the existing
objc2_foundation_derive
helpers in this repo.The text was updated successfully, but these errors were encountered: