rust-objc icon indicating copy to clipboard operation
rust-objc copied to clipboard

Redo reference counting

Open madsmtm opened this issue 3 years ago • 2 comments

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.

madsmtm avatar May 29 '21 18:05 madsmtm

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?

SSheldon avatar Aug 04 '21 04:08 SSheldon

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?

madsmtm avatar Aug 06 '21 21:08 madsmtm