@@ -104,6 +104,12 @@ pub struct Mutable {
104
104
/// The mutable counterpart must be specified as the type parameter `MS` to
105
105
/// allow `NSCopying` and `NSMutableCopying` to return the correct type.
106
106
///
107
+ /// Functionality that is provided with this:
108
+ /// - [`IsIdCloneable`].
109
+ /// - [`IsAllocableAnyThread`].
110
+ /// - You are allowed to hand out pointers / references to an instance's
111
+ /// internal data, since you know such data will never be mutated.
112
+ ///
107
113
///
108
114
/// # Example
109
115
///
@@ -256,7 +262,11 @@ impl<IS: ?Sized> Mutability for MutableWithImmutableSuperclass<IS> {}
256
262
impl Mutability for InteriorMutable { }
257
263
impl Mutability for MainThreadOnly { }
258
264
259
- /// Marker trait for classes where [`Id::clone`][clone-id] is safe.
265
+ /// Marker trait for classes where [`Id::clone`] is safe.
266
+ ///
267
+ /// Since the `Foundation` collection types (`NSArray<T>`,
268
+ /// `NSDictionary<K, V>`, ...) act as if they store [`Id`]s, this also makes
269
+ /// certain functionality on those types possible.
260
270
///
261
271
/// This is implemented for classes whose [`ClassType::Mutability`] is one of:
262
272
/// - [`Root`].
@@ -265,19 +275,24 @@ impl Mutability for MainThreadOnly {}
265
275
/// - [`InteriorMutable`].
266
276
/// - [`MainThreadOnly`].
267
277
///
268
- /// [clone-id]: crate::rc::Id#impl-Clone-for-Id<T>
278
+ /// [`Id`]: crate::rc::Id
279
+ /// [`Id::clone`]: crate::rc::Id#impl-Clone-for-Id<T>
269
280
pub trait IsIdCloneable : ClassType { }
270
281
impl < T : ?Sized + ClassType > IsIdCloneable for T where T :: Mutability : private:: MutabilityIsIdCloneable
271
282
{ }
272
283
273
- /// Marker trait for classes where the [`retain`] selector is always safe.
284
+ /// Marker trait for classes where the `retain` selector is always safe.
285
+ ///
286
+ /// [`Id::clone`] takes `&Id<T>`, while [`ClassType::retain`] only takes `&T`;
287
+ /// the difference between these two is that in the former case, you know that
288
+ /// there are no live mutable subclasses.
274
289
///
275
290
/// This is implemented for classes whose [`ClassType::Mutability`] is one of:
276
291
/// - [`Immutable`].
277
292
/// - [`InteriorMutable`].
278
293
/// - [`MainThreadOnly`].
279
294
///
280
- /// [`retain `]: ClassType::retain
295
+ /// [`Id::clone `]: crate::rc::Id#impl-Clone-for-Id<T>
281
296
pub trait IsRetainable : IsIdCloneable { }
282
297
impl < T : ?Sized + ClassType > IsRetainable for T where T :: Mutability : private:: MutabilityIsRetainable { }
283
298
0 commit comments