rust-objc
rust-objc copied to clipboard
Redo reference counting
My WIP on https://github.com/SSheldon/rust-objc/issues/95.
Adds Retained
, a smart pointer version of StrongPtr
, but with more guarantees. Notably, this has an Deref<Target = T>
implementation, which makes it more ergonomic and safer to use.
Also adds Owned
, the mutable version of Retained
with a DerefMut<Target = T>
implementation.
I'm thinking about removing StrongPtr
completely in favour of this (since it's behaviour can be achieved with Retained<Object>
), but please voice your opinion on this, and how we should handle backwards compatibility.
Like you mention in your comment here: https://github.com/SSheldon/rust-objc/issues/95#issuecomment-854006099
I'd like to build this out-of-crate for now. objc-id was my attempt, and I'm not that happy with it. Perhaps you can build this in another crate first and prove it there?
Can you elaborate on what you were unhappy with in objc-id
? Was the problem that it didn't work for cocoa
, or something else?