AnyThread

Trait AnyThread 

Source
pub unsafe trait AnyThread: SealedAnyThread {
    // Provided method
    fn alloc() -> Allocated<Self>
       where Self: Sized + ClassType { ... }
}
Expand description

Marker trait for classes (and protocols) that are usable from any thread, i.e. the opposite of MainThreadOnly.

This is mostly an implementation detail to expose the alloc method with different signatures depending on whether a class is main thread only or not. You can safely assume that things are safe to use from any thread, unless they implement MainThreadOnly, not only if they implement this trait.

§Safety

This is a sealed trait, and should not need to be implemented; it is implemented automatically when you implement ClassType.

Provided Methods§

Source

fn alloc() -> Allocated<Self>
where Self: Sized + ClassType,

Allocate a new instance of the class.

The return value can be used directly inside msg_send! to initialize the object.

Trait Implementations§

Source§

impl ThreadKind for dyn AnyThread + '_

Implementors§

Source§

impl<'a, T: ?Sized + ClassType<ThreadKind = dyn AnyThread + 'a>> AnyThread for T

Source§

impl<P: ?Sized + AnyThread> AnyThread for ProtocolObject<P>