RefCountable provides an abstraction over the various core-allocated refcounted resources. It is important that consumers don't acquire ownership of a `RefCountable` object directly -- they should only ever get their hands on a `Ref ` or `&T`, otherwise it would be possible for the allocation in the core to be trivially leaked, as `T` does not have the `Drop` impl `T` does not have the `Drop`
| 36 | // efficient handling of core owned objects we receive pointers |
| 37 | // to in callbacks |
| 38 | pub(crate) unsafe trait RefCountable: ToOwned<Owned = Ref<Self>> + Sized { |
| 39 | unsafe fn inc_ref(handle: &Self) -> Ref<Self>; |
| 40 | unsafe fn dec_ref(handle: &Self); |
| 41 | } |
| 42 | |
| 43 | // Represents an 'owned' reference tracked by the core |
| 44 | // that we are responsible for cleaning up once we're |
nothing calls this directly
no outgoing calls
no test coverage detected