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 { ... }
}
Available on crate feature
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
Implementations on Foreign Types§
impl<T> NSMutableCopying for ProtocolObject<T>where
T: ?Sized + NSMutableCopying,
Implementors§
impl NSMutableCopying for NSAttributedString
Available on crate feature
NSAttributedString
only.impl NSMutableCopying for NSCharacterSet
Available on crate feature
NSCharacterSet
only.impl NSMutableCopying for NSData
Available on crate feature
NSData
only.impl NSMutableCopying for NSIndexSet
Available on crate feature
NSIndexSet
only.impl NSMutableCopying for NSMutableAttributedString
Available on crate feature
NSAttributedString
only.impl NSMutableCopying for NSMutableCharacterSet
Available on crate feature
NSCharacterSet
only.impl NSMutableCopying for NSMutableData
Available on crate feature
NSData
only.impl NSMutableCopying for NSMutableIndexSet
Available on crate feature
NSIndexSet
only.impl NSMutableCopying for NSMutableString
Available on crate feature
NSString
only.impl NSMutableCopying for NSMutableURLRequest
Available on crate feature
NSURLRequest
only.impl NSMutableCopying for NSString
Available on crate feature
NSString
only.impl NSMutableCopying for NSURLRequest
Available on crate feature
NSURLRequest
only.impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSDictionary<KeyType, ObjectType>
Available on crate feature
NSDictionary
only.impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSMutableDictionary<KeyType, ObjectType>
Available on crate feature
NSDictionary
only.impl<ObjectType: ?Sized> NSMutableCopying for NSArray<ObjectType>
Available on crate feature
NSArray
only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableArray<ObjectType>
Available on crate feature
NSArray
only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableOrderedSet<ObjectType>
Available on crate feature
NSOrderedSet
only.impl<ObjectType: ?Sized> NSMutableCopying for NSMutableSet<ObjectType>
Available on crate feature
NSSet
only.impl<ObjectType: ?Sized> NSMutableCopying for NSOrderedSet<ObjectType>
Available on crate feature
NSOrderedSet
only.impl<ObjectType: ?Sized> NSMutableCopying for NSSet<ObjectType>
Available on crate feature
NSSet
only.