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