pub unsafe trait NSMutableCopying {
// Provided methods
fn mutableCopy(&self) -> Retained<Self::Result>
where Self: Sized + Message + MutableCopyingHelper { ... }
unsafe fn mutableCopyWithZone(
&self,
zone: *mut NSZone,
) -> Retained<Self::Result>
where Self: Sized + Message + MutableCopyingHelper { ... }
}NSObject only.Expand description
A protocol to provide mutable copies of objects.
Only classes that have an “immutable vs. mutable” distinction should
adopt this protocol. Use the MutableCopyingHelper trait to specify
the return type after copying.
See Apple’s documentation for details.
§Example
Implement NSCopying and NSMutableCopying for a class pair like
NSString and NSMutableString.
// Immutable copies return NSString
unsafe impl NSCopying for NSString {}
unsafe impl CopyingHelper for NSString {
type Result = NSString;
}
unsafe impl NSCopying for NSMutableString {}
unsafe impl CopyingHelper for NSMutableString {
type Result = NSString;
}
// Mutable copies return NSMutableString
unsafe impl NSMutableCopying for NSString {}
unsafe impl MutableCopyingHelper for NSString {
type Result = NSMutableString;
}
unsafe impl NSMutableCopying for NSMutableString {}
unsafe impl MutableCopyingHelper for NSMutableString {
type Result = NSMutableString;
}Provided Methods§
Sourcefn mutableCopy(&self) -> Retained<Self::Result>
fn mutableCopy(&self) -> Retained<Self::Result>
Returns a new instance that’s a mutable copy of the receiver.
The output type is the mutable counterpart of the object. E.g. both
NSString and NSMutableString return NSMutableString.
Sourceunsafe fn mutableCopyWithZone(
&self,
zone: *mut NSZone,
) -> Retained<Self::Result>
unsafe fn mutableCopyWithZone( &self, zone: *mut NSZone, ) -> Retained<Self::Result>
Returns a new instance that’s a mutable copy of the receiver.
This is only used when implementing NSMutableCopying, call
mutableCopy instead.
§Safety
The zone pointer must be valid or NULL.
Trait Implementations§
Source§impl ProtocolType for dyn NSMutableCopying
impl ProtocolType for dyn NSMutableCopying
impl<T> ImplementedBy<T> for dyn NSMutableCopying
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
impl<T> NSMutableCopying for ProtocolObject<T>where
T: ?Sized + NSMutableCopying,
Implementors§
impl NSMutableCopying for NSAttributedString
NSAttributedString only.impl NSMutableCopying for NSCharacterSet
NSCharacterSet only.impl NSMutableCopying for NSData
NSData only.impl NSMutableCopying for NSIndexSet
NSIndexSet only.impl NSMutableCopying for NSMutableAttributedString
NSAttributedString only.impl NSMutableCopying for NSMutableCharacterSet
NSCharacterSet only.impl NSMutableCopying for NSMutableData
NSData only.impl NSMutableCopying for NSMutableIndexSet
NSIndexSet only.impl NSMutableCopying for NSMutableString
NSString only.impl NSMutableCopying for NSMutableURLRequest
NSURLRequest only.impl NSMutableCopying for NSString
NSString only.impl NSMutableCopying for NSURLRequest
NSURLRequest only.impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSDictionary<KeyType, ObjectType>
NSDictionary only.impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSMutableDictionary<KeyType, ObjectType>
NSDictionary only.impl<ObjectType: ?Sized> NSMutableCopying for NSArray<ObjectType>
NSArray only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableArray<ObjectType>
NSArray only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableOrderedSet<ObjectType>
NSOrderedSet only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableSet<ObjectType>
NSSet only.impl<ObjectType: ?Sized> NSMutableCopying for NSOrderedSet<ObjectType>
NSOrderedSet only.impl<ObjectType: ?Sized> NSMutableCopying for NSSet<ObjectType>
NSSet only.