Struct objc2::mutability::ImmutableWithMutableSubclass
source · pub struct ImmutableWithMutableSubclass<MS: ?Sized> { /* private fields */ }
Expand description
Marker type for immutable classes that have a mutable counterpart.
This is effectively the same as Immutable
, except for the fact that
classes that specify this does not implement IsRetainable
, meaning
that ClassType::retain
does not work (see that for details on why).
The mutable counterpart must be specified as the type parameter MS
to
allow NSCopying
and NSMutableCopying
to return the correct type.
Functionality that is provided with this:
IsIdCloneable
.IsAllocableAnyThread
.IsAllowedMutable
.- You are allowed to hand out pointers / references to an instance’s internal data, since you know such data will never be mutated.
§Example
ⓘ
unsafe impl ClassType for NSString {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableString>;
// ...
}
unsafe impl ClassType for NSMutableString {
type Super = NSString;
type Mutability = MutableWithImmutableSubclass<NSString>;
// ...
}
Trait Implementations§
source§impl<MS: Clone + ?Sized> Clone for ImmutableWithMutableSubclass<MS>
impl<MS: Clone + ?Sized> Clone for ImmutableWithMutableSubclass<MS>
source§fn clone(&self) -> ImmutableWithMutableSubclass<MS>
fn clone(&self) -> ImmutableWithMutableSubclass<MS>
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<MS: Ord + ?Sized> Ord for ImmutableWithMutableSubclass<MS>
impl<MS: Ord + ?Sized> Ord for ImmutableWithMutableSubclass<MS>
source§fn cmp(&self, other: &ImmutableWithMutableSubclass<MS>) -> Ordering
fn cmp(&self, other: &ImmutableWithMutableSubclass<MS>) -> 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<MS: PartialEq + ?Sized> PartialEq for ImmutableWithMutableSubclass<MS>
impl<MS: PartialEq + ?Sized> PartialEq for ImmutableWithMutableSubclass<MS>
source§fn eq(&self, other: &ImmutableWithMutableSubclass<MS>) -> bool
fn eq(&self, other: &ImmutableWithMutableSubclass<MS>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<MS: PartialOrd + ?Sized> PartialOrd for ImmutableWithMutableSubclass<MS>
impl<MS: PartialOrd + ?Sized> PartialOrd for ImmutableWithMutableSubclass<MS>
source§fn partial_cmp(
&self,
other: &ImmutableWithMutableSubclass<MS>
) -> Option<Ordering>
fn partial_cmp( &self, other: &ImmutableWithMutableSubclass<MS> ) -> 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<MS: Copy + ?Sized> Copy for ImmutableWithMutableSubclass<MS>
impl<MS: Eq + ?Sized> Eq for ImmutableWithMutableSubclass<MS>
impl<MS: ?Sized> Mutability for ImmutableWithMutableSubclass<MS>
impl<MS: ?Sized> StructuralPartialEq for ImmutableWithMutableSubclass<MS>
Auto Trait Implementations§
impl<MS> Freeze for ImmutableWithMutableSubclass<MS>where
MS: ?Sized,
impl<MS> RefUnwindSafe for ImmutableWithMutableSubclass<MS>where
MS: RefUnwindSafe + ?Sized,
impl<MS> Send for ImmutableWithMutableSubclass<MS>
impl<MS> Sync for ImmutableWithMutableSubclass<MS>
impl<MS> Unpin for ImmutableWithMutableSubclass<MS>
impl<MS> UnwindSafe for ImmutableWithMutableSubclass<MS>where
MS: 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