Skip to content

Conversation

@madsmtm
Copy link
Owner

@madsmtm madsmtm commented Jan 15, 2023

UnsafeCell is possible since rust-lang/rust#101717, and Cell is possible since rust-lang/rust#106921.

This is actually really important, since most user-declared classes should use interior mutability (e.g. when overriding NSView or NSWindowDelegate).

@madsmtm madsmtm added enhancement New feature or request A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates labels Jan 15, 2023
@madsmtm madsmtm mentioned this pull request Jan 18, 2023
@madsmtm madsmtm changed the title Implement Encode and RefEncode for UnsafeCell Implement Encode and RefEncode for UnsafeCell and Cell Jan 27, 2023
@madsmtm madsmtm added this to the objc2 v0.3 milestone Jan 27, 2023
@madsmtm madsmtm force-pushed the encode-unsafecell branch from 630032a to c00d765 Compare March 27, 2023 14:54
@madsmtm madsmtm merged commit 0365ef4 into master Mar 30, 2023
@madsmtm madsmtm deleted the encode-unsafecell branch March 30, 2023 17:04
madsmtm pushed a commit that referenced this pull request Jan 12, 2026
…st()` (#351)

Noticed that one more pointer was being transmuted to another type
rather than using a trivial cast, before `unsafe`ly dereferencing it.

This also removes the `ptr::read()` syntax introduced in #344 again,
in favour of using a simple and more standard `*` deref.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant