Skip to content

Commit aa13544

Browse files
committed
Add more in-depth docs on IsMainThreadOnly
1 parent 9fbdbf4 commit aa13544

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/objc2/src/mutability.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ impl<T: ?Sized + ClassType> IsMutable for T where T::Mutability: private::Mutabi
315315
///
316316
/// This is implemented for classes whose [`ClassType::Mutability`] is one of:
317317
/// - [`MainThreadOnly`].
318+
///
319+
/// Since `MainThreadOnly` types must be `!Send` and `!Sync`, if you hold a
320+
/// type that implements this trait, then you're guaranteed to be on the main
321+
/// thread.
318322
//
319323
// Note: MainThreadMarker::from relies on this.
320324
pub trait IsMainThreadOnly: ClassType {}

0 commit comments

Comments
 (0)