Trait NSMutableCopying

Source
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§

Source

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.

Source

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

Source§

const NAME: &'static str = "NSMutableCopying"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSMutableCopying

Implementations on Foreign Types§

Source§

impl<T> NSMutableCopying for ProtocolObject<T>
where T: ?Sized + NSMutableCopying,

Implementors§

Source§

impl NSMutableCopying for NSAttributedString

Available on crate feature NSAttributedString only.
Source§

impl NSMutableCopying for NSCharacterSet

Available on crate feature NSCharacterSet only.
Source§

impl NSMutableCopying for NSData

Available on crate feature NSData only.
Source§

impl NSMutableCopying for NSIndexSet

Available on crate feature NSIndexSet only.
Source§

impl NSMutableCopying for NSMutableAttributedString

Available on crate feature NSAttributedString only.
Source§

impl NSMutableCopying for NSMutableCharacterSet

Available on crate feature NSCharacterSet only.
Source§

impl NSMutableCopying for NSMutableData

Available on crate feature NSData only.
Source§

impl NSMutableCopying for NSMutableIndexSet

Available on crate feature NSIndexSet only.
Source§

impl NSMutableCopying for NSMutableString

Available on crate feature NSString only.
Source§

impl NSMutableCopying for NSMutableURLRequest

Available on crate feature NSURLRequest only.
Source§

impl NSMutableCopying for NSString

Available on crate feature NSString only.
Source§

impl NSMutableCopying for NSURLRequest

Available on crate feature NSURLRequest only.
Source§

impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSDictionary<KeyType, ObjectType>

Available on crate feature NSDictionary only.
Source§

impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying for NSMutableDictionary<KeyType, ObjectType>

Available on crate feature NSDictionary only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSArray<ObjectType>

Available on crate feature NSArray only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSMutableArray<ObjectType>

Available on crate feature NSArray only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSMutableOrderedSet<ObjectType>

Available on crate feature NSOrderedSet only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSMutableSet<ObjectType>

Available on crate feature NSSet only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSOrderedSet<ObjectType>

Available on crate feature NSOrderedSet only.
Source§

impl<ObjectType: ?Sized> NSMutableCopying for NSSet<ObjectType>

Available on crate feature NSSet only.