objc2_foundation/generated/
NSDictionary.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10    /// **************    Immutable Dictionary    ***************
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdictionary?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(PartialEq, Eq, Hash)]
15    pub struct NSDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject>;
16);
17
18#[cfg(feature = "NSObject")]
19unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
20    for NSDictionary<KeyType, ObjectType>
21{
22}
23
24#[cfg(feature = "NSObject")]
25unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSCopying for NSDictionary<KeyType, ObjectType> {}
26
27#[cfg(feature = "NSObject")]
28unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> CopyingHelper
29    for NSDictionary<KeyType, ObjectType>
30{
31    type Result = Self;
32}
33
34#[cfg(feature = "NSEnumerator")]
35unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
36    for NSDictionary<KeyType, ObjectType>
37{
38}
39
40#[cfg(feature = "NSObject")]
41unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying
42    for NSDictionary<KeyType, ObjectType>
43{
44}
45
46#[cfg(feature = "NSObject")]
47unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> MutableCopyingHelper
48    for NSDictionary<KeyType, ObjectType>
49{
50    type Result = NSMutableDictionary<KeyType, ObjectType>;
51}
52
53unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
54    for NSDictionary<KeyType, ObjectType>
55{
56}
57
58#[cfg(feature = "NSObject")]
59unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
60    for NSDictionary<KeyType, ObjectType>
61{
62}
63
64impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
65    extern_methods!(
66        #[unsafe(method(count))]
67        #[unsafe(method_family = none)]
68        pub fn count(&self) -> NSUInteger;
69
70        #[unsafe(method(objectForKey:))]
71        #[unsafe(method_family = none)]
72        pub fn objectForKey(&self, a_key: &KeyType) -> Option<Retained<ObjectType>>;
73
74        #[cfg(feature = "NSEnumerator")]
75        #[unsafe(method(keyEnumerator))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn keyEnumerator(&self) -> Retained<NSEnumerator<KeyType>>;
78
79        #[unsafe(method(init))]
80        #[unsafe(method_family = init)]
81        pub fn init(this: Allocated<Self>) -> Retained<Self>;
82
83        #[cfg(feature = "NSObject")]
84        #[unsafe(method(initWithObjects:forKeys:count:))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn initWithObjects_forKeys_count(
87            this: Allocated<Self>,
88            objects: *mut NonNull<ObjectType>,
89            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
90            cnt: NSUInteger,
91        ) -> Retained<Self>;
92
93        #[cfg(feature = "NSCoder")]
94        #[unsafe(method(initWithCoder:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithCoder(
97            this: Allocated<Self>,
98            coder: &NSCoder,
99        ) -> Option<Retained<Self>>;
100    );
101}
102
103/// Methods declared on superclass `NSObject`.
104impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
105    extern_methods!(
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub fn new() -> Retained<Self>;
109    );
110}
111
112impl<KeyType: Message, ObjectType: Message> DefaultRetained for NSDictionary<KeyType, ObjectType> {
113    #[inline]
114    fn default_retained() -> Retained<Self> {
115        Self::new()
116    }
117}
118
119/// NSExtendedDictionary.
120impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
121    extern_methods!(
122        #[cfg(feature = "NSArray")]
123        #[unsafe(method(allKeys))]
124        #[unsafe(method_family = none)]
125        pub fn allKeys(&self) -> Retained<NSArray<KeyType>>;
126
127        #[cfg(feature = "NSArray")]
128        #[unsafe(method(allKeysForObject:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn allKeysForObject(&self, an_object: &ObjectType)
131            -> Retained<NSArray<KeyType>>;
132
133        #[cfg(feature = "NSArray")]
134        #[unsafe(method(allValues))]
135        #[unsafe(method_family = none)]
136        pub fn allValues(&self) -> Retained<NSArray<ObjectType>>;
137
138        #[cfg(feature = "NSString")]
139        #[unsafe(method(description))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn description(&self) -> Retained<NSString>;
142
143        #[cfg(feature = "NSString")]
144        #[unsafe(method(descriptionInStringsFileFormat))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn descriptionInStringsFileFormat(&self) -> Retained<NSString>;
147
148        #[cfg(feature = "NSString")]
149        #[unsafe(method(descriptionWithLocale:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn descriptionWithLocale(
152            &self,
153            locale: Option<&AnyObject>,
154        ) -> Retained<NSString>;
155
156        #[cfg(feature = "NSString")]
157        #[unsafe(method(descriptionWithLocale:indent:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn descriptionWithLocale_indent(
160            &self,
161            locale: Option<&AnyObject>,
162            level: NSUInteger,
163        ) -> Retained<NSString>;
164
165        #[unsafe(method(isEqualToDictionary:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn isEqualToDictionary(
168            &self,
169            other_dictionary: &NSDictionary<KeyType, ObjectType>,
170        ) -> bool;
171
172        #[cfg(feature = "NSEnumerator")]
173        #[unsafe(method(objectEnumerator))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
176
177        #[cfg(feature = "NSArray")]
178        #[unsafe(method(objectsForKeys:notFoundMarker:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn objectsForKeys_notFoundMarker(
181            &self,
182            keys: &NSArray<KeyType>,
183            marker: &ObjectType,
184        ) -> Retained<NSArray<ObjectType>>;
185
186        #[cfg(all(feature = "NSError", feature = "NSURL"))]
187        #[unsafe(method(writeToURL:error:_))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn writeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
190
191        #[cfg(feature = "NSArray")]
192        #[unsafe(method(keysSortedByValueUsingSelector:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn keysSortedByValueUsingSelector(
195            &self,
196            comparator: Sel,
197        ) -> Retained<NSArray<KeyType>>;
198
199        #[unsafe(method(getObjects:andKeys:count:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn getObjects_andKeys_count(
202            &self,
203            objects: *mut NonNull<ObjectType>,
204            keys: *mut NonNull<KeyType>,
205            count: NSUInteger,
206        );
207
208        #[unsafe(method(objectForKeyedSubscript:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn objectForKeyedSubscript(&self, key: &KeyType)
211            -> Option<Retained<ObjectType>>;
212
213        #[cfg(feature = "block2")]
214        #[unsafe(method(enumerateKeysAndObjectsUsingBlock:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn enumerateKeysAndObjectsUsingBlock(
217            &self,
218            block: &block2::Block<
219                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
220            >,
221        );
222
223        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
224        #[unsafe(method(enumerateKeysAndObjectsWithOptions:usingBlock:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn enumerateKeysAndObjectsWithOptions_usingBlock(
227            &self,
228            opts: NSEnumerationOptions,
229            block: &block2::Block<
230                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
231            >,
232        );
233
234        #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
235        #[unsafe(method(keysSortedByValueUsingComparator:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn keysSortedByValueUsingComparator(
238            &self,
239            cmptr: NSComparator,
240        ) -> Retained<NSArray<KeyType>>;
241
242        #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
243        #[unsafe(method(keysSortedByValueWithOptions:usingComparator:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn keysSortedByValueWithOptions_usingComparator(
246            &self,
247            opts: NSSortOptions,
248            cmptr: NSComparator,
249        ) -> Retained<NSArray<KeyType>>;
250
251        #[cfg(all(feature = "NSSet", feature = "block2"))]
252        #[unsafe(method(keysOfEntriesPassingTest:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn keysOfEntriesPassingTest(
255            &self,
256            predicate: &block2::Block<
257                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
258            >,
259        ) -> Retained<NSSet<KeyType>>;
260
261        #[cfg(all(feature = "NSObjCRuntime", feature = "NSSet", feature = "block2"))]
262        #[unsafe(method(keysOfEntriesWithOptions:passingTest:))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn keysOfEntriesWithOptions_passingTest(
265            &self,
266            opts: NSEnumerationOptions,
267            predicate: &block2::Block<
268                dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
269            >,
270        ) -> Retained<NSSet<KeyType>>;
271    );
272}
273
274/// NSDeprecated.
275impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
276    extern_methods!(
277        /// This method is unsafe because it could potentially cause buffer overruns. You should use -getObjects:andKeys:count:
278        #[deprecated = "Use -getObjects:andKeys:count: instead"]
279        #[unsafe(method(getObjects:andKeys:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn getObjects_andKeys(
282            &self,
283            objects: *mut NonNull<ObjectType>,
284            keys: *mut NonNull<KeyType>,
285        );
286
287        #[cfg(feature = "NSString")]
288        #[deprecated]
289        #[unsafe(method(dictionaryWithContentsOfFile:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn dictionaryWithContentsOfFile(
292            path: &NSString,
293        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
294
295        #[cfg(feature = "NSURL")]
296        #[deprecated]
297        #[unsafe(method(dictionaryWithContentsOfURL:))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn dictionaryWithContentsOfURL(
300            url: &NSURL,
301        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
302
303        #[cfg(feature = "NSString")]
304        #[deprecated]
305        #[unsafe(method(initWithContentsOfFile:))]
306        #[unsafe(method_family = init)]
307        pub unsafe fn initWithContentsOfFile(
308            this: Allocated<Self>,
309            path: &NSString,
310        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
311
312        #[cfg(feature = "NSURL")]
313        #[deprecated]
314        #[unsafe(method(initWithContentsOfURL:))]
315        #[unsafe(method_family = init)]
316        pub unsafe fn initWithContentsOfURL(
317            this: Allocated<Self>,
318            url: &NSURL,
319        ) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
320
321        #[cfg(feature = "NSString")]
322        #[deprecated]
323        #[unsafe(method(writeToFile:atomically:))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn writeToFile_atomically(
326            &self,
327            path: &NSString,
328            use_auxiliary_file: bool,
329        ) -> bool;
330
331        #[cfg(feature = "NSURL")]
332        #[deprecated]
333        #[unsafe(method(writeToURL:atomically:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn writeToURL_atomically(&self, url: &NSURL, atomically: bool) -> bool;
336    );
337}
338
339/// NSDictionaryCreation.
340impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
341    extern_methods!(
342        #[unsafe(method(dictionary))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn dictionary() -> Retained<Self>;
345
346        #[cfg(feature = "NSObject")]
347        #[unsafe(method(dictionaryWithObject:forKey:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn dictionaryWithObject_forKey(
350            object: &ObjectType,
351            key: &ProtocolObject<dyn NSCopying>,
352        ) -> Retained<Self>;
353
354        #[cfg(feature = "NSObject")]
355        #[unsafe(method(dictionaryWithObjects:forKeys:count:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn dictionaryWithObjects_forKeys_count(
358            objects: *mut NonNull<ObjectType>,
359            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
360            cnt: NSUInteger,
361        ) -> Retained<Self>;
362
363        #[unsafe(method(dictionaryWithDictionary:))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn dictionaryWithDictionary(
366            dict: &NSDictionary<KeyType, ObjectType>,
367        ) -> Retained<Self>;
368
369        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
370        #[unsafe(method(dictionaryWithObjects:forKeys:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn dictionaryWithObjects_forKeys(
373            objects: &NSArray<ObjectType>,
374            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
375        ) -> Retained<Self>;
376
377        #[unsafe(method(initWithDictionary:))]
378        #[unsafe(method_family = init)]
379        pub unsafe fn initWithDictionary(
380            this: Allocated<Self>,
381            other_dictionary: &NSDictionary<KeyType, ObjectType>,
382        ) -> Retained<Self>;
383
384        #[unsafe(method(initWithDictionary:copyItems:))]
385        #[unsafe(method_family = init)]
386        pub unsafe fn initWithDictionary_copyItems(
387            this: Allocated<Self>,
388            other_dictionary: &NSDictionary<KeyType, ObjectType>,
389            flag: bool,
390        ) -> Retained<Self>;
391
392        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
393        #[unsafe(method(initWithObjects:forKeys:))]
394        #[unsafe(method_family = init)]
395        pub unsafe fn initWithObjects_forKeys(
396            this: Allocated<Self>,
397            objects: &NSArray<ObjectType>,
398            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
399        ) -> Retained<Self>;
400    );
401}
402
403/// Methods declared on superclass `NSDictionary`.
404///
405/// NSDictionaryCreation.
406impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
407    extern_methods!(
408        #[unsafe(method(dictionary))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn dictionary() -> Retained<Self>;
411
412        #[cfg(feature = "NSObject")]
413        #[unsafe(method(dictionaryWithObject:forKey:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn dictionaryWithObject_forKey(
416            object: &ObjectType,
417            key: &ProtocolObject<dyn NSCopying>,
418        ) -> Retained<Self>;
419
420        #[cfg(feature = "NSObject")]
421        #[unsafe(method(dictionaryWithObjects:forKeys:count:))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn dictionaryWithObjects_forKeys_count(
424            objects: *mut NonNull<ObjectType>,
425            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
426            cnt: NSUInteger,
427        ) -> Retained<Self>;
428
429        #[unsafe(method(dictionaryWithDictionary:))]
430        #[unsafe(method_family = none)]
431        pub unsafe fn dictionaryWithDictionary(
432            dict: &NSDictionary<KeyType, ObjectType>,
433        ) -> Retained<Self>;
434
435        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
436        #[unsafe(method(dictionaryWithObjects:forKeys:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn dictionaryWithObjects_forKeys(
439            objects: &NSArray<ObjectType>,
440            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
441        ) -> Retained<Self>;
442
443        #[unsafe(method(initWithDictionary:))]
444        #[unsafe(method_family = init)]
445        pub unsafe fn initWithDictionary(
446            this: Allocated<Self>,
447            other_dictionary: &NSDictionary<KeyType, ObjectType>,
448        ) -> Retained<Self>;
449
450        #[unsafe(method(initWithDictionary:copyItems:))]
451        #[unsafe(method_family = init)]
452        pub unsafe fn initWithDictionary_copyItems(
453            this: Allocated<Self>,
454            other_dictionary: &NSDictionary<KeyType, ObjectType>,
455            flag: bool,
456        ) -> Retained<Self>;
457
458        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
459        #[unsafe(method(initWithObjects:forKeys:))]
460        #[unsafe(method_family = init)]
461        pub unsafe fn initWithObjects_forKeys(
462            this: Allocated<Self>,
463            objects: &NSArray<ObjectType>,
464            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
465        ) -> Retained<Self>;
466    );
467}
468
469extern_class!(
470    /// **************    Mutable Dictionary    ***************
471    ///
472    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutabledictionary?language=objc)
473    #[unsafe(super(NSDictionary<KeyType, ObjectType, >, NSObject))]
474    #[derive(PartialEq, Eq, Hash)]
475    pub struct NSMutableDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject>;
476);
477
478#[cfg(feature = "NSObject")]
479unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
480    for NSMutableDictionary<KeyType, ObjectType>
481{
482}
483
484#[cfg(feature = "NSObject")]
485unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSCopying
486    for NSMutableDictionary<KeyType, ObjectType>
487{
488}
489
490#[cfg(feature = "NSObject")]
491unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> CopyingHelper
492    for NSMutableDictionary<KeyType, ObjectType>
493{
494    type Result = NSDictionary<KeyType, ObjectType>;
495}
496
497#[cfg(feature = "NSEnumerator")]
498unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
499    for NSMutableDictionary<KeyType, ObjectType>
500{
501}
502
503#[cfg(feature = "NSObject")]
504unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSMutableCopying
505    for NSMutableDictionary<KeyType, ObjectType>
506{
507}
508
509#[cfg(feature = "NSObject")]
510unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> MutableCopyingHelper
511    for NSMutableDictionary<KeyType, ObjectType>
512{
513    type Result = Self;
514}
515
516unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
517    for NSMutableDictionary<KeyType, ObjectType>
518{
519}
520
521#[cfg(feature = "NSObject")]
522unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
523    for NSMutableDictionary<KeyType, ObjectType>
524{
525}
526
527impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
528    extern_methods!(
529        #[unsafe(method(removeObjectForKey:))]
530        #[unsafe(method_family = none)]
531        pub fn removeObjectForKey(&self, a_key: &KeyType);
532
533        #[cfg(feature = "NSObject")]
534        #[unsafe(method(setObject:forKey:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn setObject_forKey(
537            &self,
538            an_object: &ObjectType,
539            a_key: &ProtocolObject<dyn NSCopying>,
540        );
541
542        #[unsafe(method(init))]
543        #[unsafe(method_family = init)]
544        pub fn init(this: Allocated<Self>) -> Retained<Self>;
545
546        #[unsafe(method(initWithCapacity:))]
547        #[unsafe(method_family = init)]
548        pub fn initWithCapacity(this: Allocated<Self>, num_items: NSUInteger) -> Retained<Self>;
549
550        #[cfg(feature = "NSCoder")]
551        #[unsafe(method(initWithCoder:))]
552        #[unsafe(method_family = init)]
553        pub unsafe fn initWithCoder(
554            this: Allocated<Self>,
555            coder: &NSCoder,
556        ) -> Option<Retained<Self>>;
557    );
558}
559
560/// Methods declared on superclass `NSDictionary`.
561impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
562    extern_methods!(
563        #[cfg(feature = "NSObject")]
564        #[unsafe(method(initWithObjects:forKeys:count:))]
565        #[unsafe(method_family = init)]
566        pub unsafe fn initWithObjects_forKeys_count(
567            this: Allocated<Self>,
568            objects: *mut NonNull<ObjectType>,
569            keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
570            cnt: NSUInteger,
571        ) -> Retained<Self>;
572    );
573}
574
575/// Methods declared on superclass `NSObject`.
576impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
577    extern_methods!(
578        #[unsafe(method(new))]
579        #[unsafe(method_family = new)]
580        pub fn new() -> Retained<Self>;
581    );
582}
583
584impl<KeyType: Message, ObjectType: Message> DefaultRetained
585    for NSMutableDictionary<KeyType, ObjectType>
586{
587    #[inline]
588    fn default_retained() -> Retained<Self> {
589        Self::new()
590    }
591}
592
593/// NSExtendedMutableDictionary.
594impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
595    extern_methods!(
596        #[unsafe(method(addEntriesFromDictionary:))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn addEntriesFromDictionary(
599            &self,
600            other_dictionary: &NSDictionary<KeyType, ObjectType>,
601        );
602
603        #[unsafe(method(removeAllObjects))]
604        #[unsafe(method_family = none)]
605        pub fn removeAllObjects(&self);
606
607        #[cfg(feature = "NSArray")]
608        #[unsafe(method(removeObjectsForKeys:))]
609        #[unsafe(method_family = none)]
610        pub unsafe fn removeObjectsForKeys(&self, key_array: &NSArray<KeyType>);
611
612        #[unsafe(method(setDictionary:))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn setDictionary(&self, other_dictionary: &NSDictionary<KeyType, ObjectType>);
615
616        #[cfg(feature = "NSObject")]
617        #[unsafe(method(setObject:forKeyedSubscript:))]
618        #[unsafe(method_family = none)]
619        pub unsafe fn setObject_forKeyedSubscript(
620            &self,
621            obj: Option<&ObjectType>,
622            key: &ProtocolObject<dyn NSCopying>,
623        );
624    );
625}
626
627/// NSMutableDictionaryCreation.
628impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
629    extern_methods!(
630        #[unsafe(method(dictionaryWithCapacity:))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn dictionaryWithCapacity(num_items: NSUInteger) -> Retained<Self>;
633
634        #[cfg(feature = "NSString")]
635        #[unsafe(method(dictionaryWithContentsOfFile:))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn dictionaryWithContentsOfFile(
638            path: &NSString,
639        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
640
641        #[cfg(feature = "NSURL")]
642        #[unsafe(method(dictionaryWithContentsOfURL:))]
643        #[unsafe(method_family = none)]
644        pub unsafe fn dictionaryWithContentsOfURL(
645            url: &NSURL,
646        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
647
648        #[cfg(feature = "NSString")]
649        #[unsafe(method(initWithContentsOfFile:))]
650        #[unsafe(method_family = init)]
651        pub unsafe fn initWithContentsOfFile(
652            this: Allocated<Self>,
653            path: &NSString,
654        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
655
656        #[cfg(feature = "NSURL")]
657        #[unsafe(method(initWithContentsOfURL:))]
658        #[unsafe(method_family = init)]
659        pub unsafe fn initWithContentsOfURL(
660            this: Allocated<Self>,
661            url: &NSURL,
662        ) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
663    );
664}
665
666/// NSSharedKeySetDictionary.
667impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
668    extern_methods!(
669        #[cfg(all(feature = "NSArray", feature = "NSObject"))]
670        #[unsafe(method(sharedKeySetForKeys:))]
671        #[unsafe(method_family = none)]
672        pub unsafe fn sharedKeySetForKeys(
673            keys: &NSArray<ProtocolObject<dyn NSCopying>>,
674        ) -> Retained<AnyObject>;
675    );
676}
677
678/// NSSharedKeySetDictionary.
679impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
680    extern_methods!(
681        #[unsafe(method(dictionaryWithSharedKeySet:))]
682        #[unsafe(method_family = none)]
683        pub unsafe fn dictionaryWithSharedKeySet(
684            keyset: &AnyObject,
685        ) -> Retained<NSMutableDictionary<KeyType, ObjectType>>;
686    );
687}