Struct objc2::mutability::MainThreadOnly
source · pub struct MainThreadOnly { /* private fields */ }
Expand description
Marker type for classes that are only safe to use from the main thread.
This is effectively the same as InteriorMutable
, except that classes
that specify this are only allowed to be used from the main thread, and
hence are not IsAllocableAnyThread
.
This is commonly used in GUI code like AppKit
and UIKit
, e.g.
UIWindow
is only usable from the application’s main thread.
It is unsound to implement Send
or Sync
on a type with this
mutability.
Functionality that is provided with this:
IsRetainable
->ClassType::retain
.IsIdCloneable
->Retained::clone
.IsMainThreadOnly
->MainThreadMarker::from
.
Trait Implementations§
source§impl Clone for MainThreadOnly
impl Clone for MainThreadOnly
source§fn clone(&self) -> MainThreadOnly
fn clone(&self) -> MainThreadOnly
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MainThreadOnly
impl Debug for MainThreadOnly
source§impl Hash for MainThreadOnly
impl Hash for MainThreadOnly
source§impl Ord for MainThreadOnly
impl Ord for MainThreadOnly
source§fn cmp(&self, other: &MainThreadOnly) -> Ordering
fn cmp(&self, other: &MainThreadOnly) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for MainThreadOnly
impl PartialEq for MainThreadOnly
source§fn eq(&self, other: &MainThreadOnly) -> bool
fn eq(&self, other: &MainThreadOnly) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for MainThreadOnly
impl PartialOrd for MainThreadOnly
source§fn partial_cmp(&self, other: &MainThreadOnly) -> Option<Ordering>
fn partial_cmp(&self, other: &MainThreadOnly) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for MainThreadOnly
impl Eq for MainThreadOnly
impl Mutability for MainThreadOnly
impl StructuralPartialEq for MainThreadOnly
Auto Trait Implementations§
impl Freeze for MainThreadOnly
impl RefUnwindSafe for MainThreadOnly
impl Send for MainThreadOnly
impl Sync for MainThreadOnly
impl Unpin for MainThreadOnly
impl UnwindSafe for MainThreadOnly
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more