@@ -166,7 +166,7 @@ pub unsafe trait Message: RefEncode {
166
166
/// Use the trait to allocate a new instance of an object.
167
167
///
168
168
/// ```
169
- /// use objc2::{msg_send, AllocAnyThread };
169
+ /// use objc2::{msg_send, AnyThread };
170
170
/// use objc2::rc::Retained;
171
171
/// # use objc2::runtime::{NSObject as MyObject};
172
172
///
@@ -183,7 +183,7 @@ pub unsafe trait Message: RefEncode {
183
183
///
184
184
/// ```
185
185
/// use objc2::runtime::NSObject;
186
- /// use objc2::{extern_class, ClassType, AllocAnyThread };
186
+ /// use objc2::{extern_class, ClassType, AnyThread };
187
187
///
188
188
/// extern_class!(
189
189
/// // SAFETY: The superclass is correctly specified, and the class can be
@@ -224,12 +224,12 @@ pub unsafe trait ClassType: Message {
224
224
/// Whether the type can be used from any thread, or from only the main
225
225
/// thread.
226
226
///
227
- /// One of [`dyn AllocAnyThread `] or [`dyn MainThreadOnly`].
227
+ /// One of [`dyn AnyThread `] or [`dyn MainThreadOnly`].
228
228
///
229
229
/// Setting this makes `ClassType` provide an implementation of either
230
- /// [`AllocAnyThread `] or [`MainThreadOnly`].
230
+ /// [`AnyThread `] or [`MainThreadOnly`].
231
231
///
232
- /// [`dyn AllocAnyThread `]: AllocAnyThread
232
+ /// [`dyn AnyThread `]: AnyThread
233
233
/// [`dyn MainThreadOnly`]: MainThreadOnly
234
234
type ThreadKind : ?Sized + ThreadKind ;
235
235
@@ -398,7 +398,7 @@ fn get_protocol(name: &str) -> Option<&'static AnyProtocol> {
398
398
399
399
// Split into separate traits for better diagnostics
400
400
mod private {
401
- pub trait SealedAllocAnyThread { }
401
+ pub trait SealedAnyThread { }
402
402
pub trait SealedMainThreadOnly { }
403
403
pub trait SealedThreadKind { }
404
404
}
@@ -426,7 +426,7 @@ mod private {
426
426
// impl<T: ?Sized + MainThreadOnly> !AnyThread for T {}
427
427
//
428
428
// This isn't possible in current Rust though, so we'll have to hack it.
429
- pub unsafe trait AllocAnyThread : private:: SealedAllocAnyThread {
429
+ pub unsafe trait AnyThread : private:: SealedAnyThread {
430
430
/// Allocate a new instance of the class.
431
431
///
432
432
/// The return value can be used directly inside [`msg_send!`] to
@@ -461,14 +461,11 @@ pub unsafe trait AllocAnyThread: private::SealedAllocAnyThread {
461
461
462
462
// The impl here is a bit bad for diagnostics, but required to prevent users
463
463
// implementing the trait themselves.
464
- impl < ' a , T : ?Sized + ClassType < ThreadKind = dyn AllocAnyThread + ' a > > private:: SealedAllocAnyThread
465
- for T
466
- {
467
- }
468
- unsafe impl < ' a , T : ?Sized + ClassType < ThreadKind = dyn AllocAnyThread + ' a > > AllocAnyThread for T { }
464
+ impl < ' a , T : ?Sized + ClassType < ThreadKind = dyn AnyThread + ' a > > private:: SealedAnyThread for T { }
465
+ unsafe impl < ' a , T : ?Sized + ClassType < ThreadKind = dyn AnyThread + ' a > > AnyThread for T { }
469
466
470
- impl < P : ?Sized > private:: SealedAllocAnyThread for ProtocolObject < P > { }
471
- unsafe impl < P : ?Sized + AllocAnyThread > AllocAnyThread for ProtocolObject < P > { }
467
+ impl < P : ?Sized > private:: SealedAnyThread for ProtocolObject < P > { }
468
+ unsafe impl < P : ?Sized + AnyThread > AnyThread for ProtocolObject < P > { }
472
469
473
470
/// Marker trait for classes and protocols that are only safe to use on the
474
471
/// main thread.
@@ -569,18 +566,18 @@ unsafe impl<P: ?Sized + MainThreadOnly> MainThreadOnly for ProtocolObject<P> {}
569
566
570
567
/// The allowed values in [`ClassType::ThreadKind`].
571
568
///
572
- /// One of [`dyn AllocAnyThread `] or [`dyn MainThreadOnly`].
569
+ /// One of [`dyn AnyThread `] or [`dyn MainThreadOnly`].
573
570
///
574
- /// [`dyn AllocAnyThread `]: AllocAnyThread
571
+ /// [`dyn AnyThread `]: AnyThread
575
572
/// [`dyn MainThreadOnly`]: MainThreadOnly
576
573
pub trait ThreadKind : private:: SealedThreadKind {
577
574
// To mark `ThreadKind` as dyn-incompatible for now.
578
575
#[ doc( hidden) ]
579
576
const __DYN_INCOMPATIBLE: ( ) ;
580
577
}
581
578
582
- impl private:: SealedThreadKind for dyn AllocAnyThread + ' _ { }
583
- impl ThreadKind for dyn AllocAnyThread + ' _ {
579
+ impl private:: SealedThreadKind for dyn AnyThread + ' _ { }
580
+ impl ThreadKind for dyn AnyThread + ' _ {
584
581
const __DYN_INCOMPATIBLE: ( ) = ( ) ;
585
582
}
586
583
@@ -594,5 +591,5 @@ mod tests {
594
591
use super :: * ;
595
592
596
593
#[ allow( unused) ]
597
- fn dyn_compatible ( _: & dyn AllocAnyThread , _: & dyn MainThreadOnly ) { }
594
+ fn dyn_compatible ( _: & dyn AnyThread , _: & dyn MainThreadOnly ) { }
598
595
}
0 commit comments