Struct objc2::mutability::MutableWithImmutableSuperclass
source · pub struct MutableWithImmutableSuperclass<IS: ?Sized> { /* private fields */ }
Expand description
Marker type for mutable classes that have a immutable counterpart.
This is effectively the same as Mutable
, except for the immutable
counterpart being be specified as the type parameter IS
to allow
NSCopying
and NSMutableCopying
to return the correct type.
Functionality that is provided with this:
IsAllocableAnyThread
->ClassType::alloc
.IsAllowedMutable
.IsMutable
->impl DerefMut for Retained
.- You are allowed to hand out pointers / references to an instance’s internal data, since you know such data will never be mutated without the borrowchecker catching it.
§Example
ⓘ
unsafe impl ClassType for NSData {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableData>;
// ...
}
unsafe impl ClassType for NSMutableData {
type Super = NSData;
type Mutability = MutableWithImmutableSubclass<NSData>;
// ...
}
Trait Implementations§
source§impl<IS: Clone + ?Sized> Clone for MutableWithImmutableSuperclass<IS>
impl<IS: Clone + ?Sized> Clone for MutableWithImmutableSuperclass<IS>
source§fn clone(&self) -> MutableWithImmutableSuperclass<IS>
fn clone(&self) -> MutableWithImmutableSuperclass<IS>
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<IS: Ord + ?Sized> Ord for MutableWithImmutableSuperclass<IS>
impl<IS: Ord + ?Sized> Ord for MutableWithImmutableSuperclass<IS>
source§fn cmp(&self, other: &MutableWithImmutableSuperclass<IS>) -> Ordering
fn cmp(&self, other: &MutableWithImmutableSuperclass<IS>) -> 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<IS: PartialEq + ?Sized> PartialEq for MutableWithImmutableSuperclass<IS>
impl<IS: PartialEq + ?Sized> PartialEq for MutableWithImmutableSuperclass<IS>
source§fn eq(&self, other: &MutableWithImmutableSuperclass<IS>) -> bool
fn eq(&self, other: &MutableWithImmutableSuperclass<IS>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<IS: PartialOrd + ?Sized> PartialOrd for MutableWithImmutableSuperclass<IS>
impl<IS: PartialOrd + ?Sized> PartialOrd for MutableWithImmutableSuperclass<IS>
source§fn partial_cmp(
&self,
other: &MutableWithImmutableSuperclass<IS>
) -> Option<Ordering>
fn partial_cmp( &self, other: &MutableWithImmutableSuperclass<IS> ) -> 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<IS: Copy + ?Sized> Copy for MutableWithImmutableSuperclass<IS>
impl<IS: Eq + ?Sized> Eq for MutableWithImmutableSuperclass<IS>
impl<IS: ?Sized> Mutability for MutableWithImmutableSuperclass<IS>
impl<IS: ?Sized> StructuralPartialEq for MutableWithImmutableSuperclass<IS>
Auto Trait Implementations§
impl<IS> Freeze for MutableWithImmutableSuperclass<IS>where
IS: ?Sized,
impl<IS> RefUnwindSafe for MutableWithImmutableSuperclass<IS>where
IS: RefUnwindSafe + ?Sized,
impl<IS> Send for MutableWithImmutableSuperclass<IS>
impl<IS> Sync for MutableWithImmutableSuperclass<IS>
impl<IS> Unpin for MutableWithImmutableSuperclass<IS>
impl<IS> UnwindSafe for MutableWithImmutableSuperclass<IS>where
IS: UnwindSafe + ?Sized,
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