//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ffi::*; use core::ptr::NonNull; use objc2::__framework_prelude::*; #[cfg(feature = "objc2-core-foundation")] use objc2_core_foundation::*; use crate::*; extern_class!( /// ************** Immutable Set *************** /// /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsset?language=objc) #[unsafe(super(NSObject))] #[derive(PartialEq, Eq, Hash)] pub struct NSSet; ); #[cfg(feature = "objc2-core-foundation")] impl AsRef> for CFSet { #[inline] fn as_ref(&self) -> &NSSet { unsafe { &*((self as *const Self).cast()) } } } #[cfg(feature = "objc2-core-foundation")] impl AsRef> for NSSet { #[inline] fn as_ref(&self) -> &CFSet { unsafe { &*((self as *const Self).cast()) } } } impl NSSet { /// Unchecked conversion of the generic parameter. /// /// # Safety /// /// The generic must be valid to reinterpret as the given type. #[inline] pub unsafe fn cast_unchecked(&self) -> &NSSet { unsafe { &*((self as *const Self).cast()) } } } #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSCoding for NSSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSCopying for NSSet {} ); #[cfg(feature = "NSObject")] unsafe impl CopyingHelper for NSSet { type Result = Self; } #[cfg(feature = "NSEnumerator")] extern_conformance!( unsafe impl NSFastEnumeration for NSSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSMutableCopying for NSSet {} ); #[cfg(feature = "NSObject")] unsafe impl MutableCopyingHelper for NSSet { type Result = NSMutableSet; } extern_conformance!( unsafe impl NSObjectProtocol for NSSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSSecureCoding for NSSet {} ); impl NSSet { extern_methods!( #[unsafe(method(count))] #[unsafe(method_family = none)] pub fn count(&self) -> NSUInteger; #[unsafe(method(member:))] #[unsafe(method_family = none)] pub fn member(&self, object: &ObjectType) -> Option>; #[cfg(feature = "NSEnumerator")] /// # Safety /// /// The returned enumerator's underlying collection should not be mutated while in use. #[unsafe(method(objectEnumerator))] #[unsafe(method_family = none)] pub unsafe fn objectEnumerator(&self) -> Retained>; #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; /// # Safety /// /// `objects` must be a valid pointer or null. #[unsafe(method(initWithObjects:count:))] #[unsafe(method_family = init)] pub unsafe fn initWithObjects_count( this: Allocated, objects: *mut NonNull, cnt: NSUInteger, ) -> Retained; #[cfg(feature = "NSCoder")] /// # Safety /// /// `coder` possibly has further requirements. #[unsafe(method(initWithCoder:))] #[unsafe(method_family = init)] pub unsafe fn initWithCoder( this: Allocated, coder: &NSCoder, ) -> Option>; ); } /// Methods declared on superclass `NSObject`. impl NSSet { extern_methods!( #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSSet { #[inline] fn default_retained() -> Retained { Self::new() } } /// NSExtendedSet. impl NSSet { extern_methods!( #[cfg(feature = "NSArray")] #[unsafe(method(allObjects))] #[unsafe(method_family = none)] pub fn allObjects(&self) -> Retained>; #[unsafe(method(anyObject))] #[unsafe(method_family = none)] pub fn anyObject(&self) -> Option>; #[unsafe(method(containsObject:))] #[unsafe(method_family = none)] pub fn containsObject(&self, an_object: &ObjectType) -> bool; #[cfg(feature = "NSString")] #[unsafe(method(description))] #[unsafe(method_family = none)] pub fn description(&self) -> Retained; #[cfg(feature = "NSString")] /// # Safety /// /// `locale` should be of the correct type. #[unsafe(method(descriptionWithLocale:))] #[unsafe(method_family = none)] pub unsafe fn descriptionWithLocale( &self, locale: Option<&AnyObject>, ) -> Retained; #[unsafe(method(intersectsSet:))] #[unsafe(method_family = none)] pub fn intersectsSet(&self, other_set: &NSSet) -> bool; #[unsafe(method(isEqualToSet:))] #[unsafe(method_family = none)] pub fn isEqualToSet(&self, other_set: &NSSet) -> bool; #[unsafe(method(isSubsetOfSet:))] #[unsafe(method_family = none)] pub fn isSubsetOfSet(&self, other_set: &NSSet) -> bool; /// # Safety /// /// `a_selector` must be a valid selector. #[unsafe(method(makeObjectsPerformSelector:))] #[unsafe(method_family = none)] pub unsafe fn makeObjectsPerformSelector(&self, a_selector: Sel); /// # Safety /// /// - `a_selector` must be a valid selector. /// - `argument` should be of the correct type. #[unsafe(method(makeObjectsPerformSelector:withObject:))] #[unsafe(method_family = none)] pub unsafe fn makeObjectsPerformSelector_withObject( &self, a_selector: Sel, argument: Option<&AnyObject>, ); #[unsafe(method(setByAddingObject:))] #[unsafe(method_family = none)] pub fn setByAddingObject(&self, an_object: &ObjectType) -> Retained>; #[unsafe(method(setByAddingObjectsFromSet:))] #[unsafe(method_family = none)] pub fn setByAddingObjectsFromSet( &self, other: &NSSet, ) -> Retained>; #[cfg(feature = "NSArray")] #[unsafe(method(setByAddingObjectsFromArray:))] #[unsafe(method_family = none)] pub fn setByAddingObjectsFromArray( &self, other: &NSArray, ) -> Retained>; #[cfg(feature = "block2")] #[unsafe(method(enumerateObjectsUsingBlock:))] #[unsafe(method_family = none)] pub fn enumerateObjectsUsingBlock( &self, block: &block2::DynBlock, NonNull) + '_>, ); #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))] #[unsafe(method(enumerateObjectsWithOptions:usingBlock:))] #[unsafe(method_family = none)] pub fn enumerateObjectsWithOptions_usingBlock( &self, opts: NSEnumerationOptions, block: &block2::DynBlock, NonNull) + '_>, ); #[cfg(feature = "block2")] #[unsafe(method(objectsPassingTest:))] #[unsafe(method_family = none)] pub fn objectsPassingTest( &self, predicate: &block2::DynBlock, NonNull) -> Bool + '_>, ) -> Retained>; #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))] #[unsafe(method(objectsWithOptions:passingTest:))] #[unsafe(method_family = none)] pub fn objectsWithOptions_passingTest( &self, opts: NSEnumerationOptions, predicate: &block2::DynBlock, NonNull) -> Bool + '_>, ) -> Retained>; ); } /// NSSetCreation. impl NSSet { extern_methods!( #[unsafe(method(set))] #[unsafe(method_family = none)] pub fn set() -> Retained; #[unsafe(method(setWithObject:))] #[unsafe(method_family = none)] pub fn setWithObject(object: &ObjectType) -> Retained; /// # Safety /// /// `objects` must be a valid pointer. #[unsafe(method(setWithObjects:count:))] #[unsafe(method_family = none)] pub unsafe fn setWithObjects_count( objects: NonNull>, cnt: NSUInteger, ) -> Retained; #[unsafe(method(setWithSet:))] #[unsafe(method_family = none)] pub fn setWithSet(set: &NSSet) -> Retained; #[cfg(feature = "NSArray")] #[unsafe(method(setWithArray:))] #[unsafe(method_family = none)] pub fn setWithArray(array: &NSArray) -> Retained; #[unsafe(method(initWithSet:))] #[unsafe(method_family = init)] pub fn initWithSet(this: Allocated, set: &NSSet) -> Retained; #[unsafe(method(initWithSet:copyItems:))] #[unsafe(method_family = init)] pub unsafe fn initWithSet_copyItems( this: Allocated, set: &NSSet, flag: bool, ) -> Retained; #[cfg(feature = "NSArray")] #[unsafe(method(initWithArray:))] #[unsafe(method_family = init)] pub fn initWithArray(this: Allocated, array: &NSArray) -> Retained; ); } /// Methods declared on superclass `NSSet`. /// /// NSSetCreation. impl NSMutableSet { extern_methods!( #[unsafe(method(set))] #[unsafe(method_family = none)] pub fn set() -> Retained; #[unsafe(method(setWithObject:))] #[unsafe(method_family = none)] pub fn setWithObject(object: &ObjectType) -> Retained; /// # Safety /// /// `objects` must be a valid pointer. #[unsafe(method(setWithObjects:count:))] #[unsafe(method_family = none)] pub unsafe fn setWithObjects_count( objects: NonNull>, cnt: NSUInteger, ) -> Retained; #[unsafe(method(setWithSet:))] #[unsafe(method_family = none)] pub fn setWithSet(set: &NSSet) -> Retained; #[cfg(feature = "NSArray")] #[unsafe(method(setWithArray:))] #[unsafe(method_family = none)] pub fn setWithArray(array: &NSArray) -> Retained; #[unsafe(method(initWithSet:))] #[unsafe(method_family = init)] pub fn initWithSet(this: Allocated, set: &NSSet) -> Retained; #[unsafe(method(initWithSet:copyItems:))] #[unsafe(method_family = init)] pub unsafe fn initWithSet_copyItems( this: Allocated, set: &NSSet, flag: bool, ) -> Retained; #[cfg(feature = "NSArray")] #[unsafe(method(initWithArray:))] #[unsafe(method_family = init)] pub fn initWithArray(this: Allocated, array: &NSArray) -> Retained; ); } extern_class!( /// ************** Mutable Set *************** /// /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutableset?language=objc) #[unsafe(super(NSSet, NSObject))] #[derive(PartialEq, Eq, Hash)] pub struct NSMutableSet; ); #[cfg(feature = "objc2-core-foundation")] impl AsRef> for CFMutableSet { #[inline] fn as_ref(&self) -> &NSMutableSet { unsafe { &*((self as *const Self).cast()) } } } #[cfg(feature = "objc2-core-foundation")] impl AsRef> for NSMutableSet { #[inline] fn as_ref(&self) -> &CFMutableSet { unsafe { &*((self as *const Self).cast()) } } } impl NSMutableSet { /// Unchecked conversion of the generic parameter. /// /// # Safety /// /// The generic must be valid to reinterpret as the given type. #[inline] pub unsafe fn cast_unchecked( &self, ) -> &NSMutableSet { unsafe { &*((self as *const Self).cast()) } } } #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSCoding for NSMutableSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSCopying for NSMutableSet {} ); #[cfg(feature = "NSObject")] unsafe impl CopyingHelper for NSMutableSet { type Result = NSSet; } #[cfg(feature = "NSEnumerator")] extern_conformance!( unsafe impl NSFastEnumeration for NSMutableSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSMutableCopying for NSMutableSet {} ); #[cfg(feature = "NSObject")] unsafe impl MutableCopyingHelper for NSMutableSet { type Result = Self; } extern_conformance!( unsafe impl NSObjectProtocol for NSMutableSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSSecureCoding for NSMutableSet {} ); impl NSMutableSet { extern_methods!( #[unsafe(method(addObject:))] #[unsafe(method_family = none)] pub fn addObject(&self, object: &ObjectType); #[unsafe(method(removeObject:))] #[unsafe(method_family = none)] pub fn removeObject(&self, object: &ObjectType); #[cfg(feature = "NSCoder")] /// # Safety /// /// `coder` possibly has further requirements. #[unsafe(method(initWithCoder:))] #[unsafe(method_family = init)] pub unsafe fn initWithCoder( this: Allocated, coder: &NSCoder, ) -> Option>; #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; #[unsafe(method(initWithCapacity:))] #[unsafe(method_family = init)] pub fn initWithCapacity(this: Allocated, num_items: NSUInteger) -> Retained; ); } /// Methods declared on superclass `NSSet`. impl NSMutableSet { extern_methods!( /// # Safety /// /// `objects` must be a valid pointer or null. #[unsafe(method(initWithObjects:count:))] #[unsafe(method_family = init)] pub unsafe fn initWithObjects_count( this: Allocated, objects: *mut NonNull, cnt: NSUInteger, ) -> Retained; ); } /// Methods declared on superclass `NSObject`. impl NSMutableSet { extern_methods!( #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSMutableSet { #[inline] fn default_retained() -> Retained { Self::new() } } /// NSExtendedMutableSet. impl NSMutableSet { extern_methods!( #[cfg(feature = "NSArray")] #[unsafe(method(addObjectsFromArray:))] #[unsafe(method_family = none)] pub fn addObjectsFromArray(&self, array: &NSArray); #[unsafe(method(intersectSet:))] #[unsafe(method_family = none)] pub fn intersectSet(&self, other_set: &NSSet); #[unsafe(method(minusSet:))] #[unsafe(method_family = none)] pub fn minusSet(&self, other_set: &NSSet); #[unsafe(method(removeAllObjects))] #[unsafe(method_family = none)] pub fn removeAllObjects(&self); #[unsafe(method(unionSet:))] #[unsafe(method_family = none)] pub fn unionSet(&self, other_set: &NSSet); #[unsafe(method(setSet:))] #[unsafe(method_family = none)] pub fn setSet(&self, other_set: &NSSet); ); } /// NSMutableSetCreation. impl NSMutableSet { extern_methods!( #[unsafe(method(setWithCapacity:))] #[unsafe(method_family = none)] pub fn setWithCapacity(num_items: NSUInteger) -> Retained; ); } extern_class!( /// ************** Counted Set *************** /// /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nscountedset?language=objc) #[unsafe(super(NSMutableSet, NSSet, NSObject))] #[derive(PartialEq, Eq, Hash)] pub struct NSCountedSet; ); impl NSCountedSet { /// Unchecked conversion of the generic parameter. /// /// # Safety /// /// The generic must be valid to reinterpret as the given type. #[inline] pub unsafe fn cast_unchecked( &self, ) -> &NSCountedSet { unsafe { &*((self as *const Self).cast()) } } } #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSCoding for NSCountedSet {} ); #[cfg(feature = "NSEnumerator")] extern_conformance!( unsafe impl NSFastEnumeration for NSCountedSet {} ); extern_conformance!( unsafe impl NSObjectProtocol for NSCountedSet {} ); #[cfg(feature = "NSObject")] extern_conformance!( unsafe impl NSSecureCoding for NSCountedSet {} ); impl NSCountedSet { extern_methods!( #[unsafe(method(initWithCapacity:))] #[unsafe(method_family = init)] pub fn initWithCapacity(this: Allocated, num_items: NSUInteger) -> Retained; #[cfg(feature = "NSArray")] #[unsafe(method(initWithArray:))] #[unsafe(method_family = init)] pub fn initWithArray(this: Allocated, array: &NSArray) -> Retained; #[unsafe(method(initWithSet:))] #[unsafe(method_family = init)] pub fn initWithSet(this: Allocated, set: &NSSet) -> Retained; #[unsafe(method(countForObject:))] #[unsafe(method_family = none)] pub fn countForObject(&self, object: &ObjectType) -> NSUInteger; #[cfg(feature = "NSEnumerator")] /// # Safety /// /// The returned enumerator's underlying collection should not be mutated while in use. #[unsafe(method(objectEnumerator))] #[unsafe(method_family = none)] pub unsafe fn objectEnumerator(&self) -> Retained>; #[unsafe(method(addObject:))] #[unsafe(method_family = none)] pub fn addObject(&self, object: &ObjectType); #[unsafe(method(removeObject:))] #[unsafe(method_family = none)] pub fn removeObject(&self, object: &ObjectType); ); } /// Methods declared on superclass `NSMutableSet`. impl NSCountedSet { extern_methods!( #[cfg(feature = "NSCoder")] /// # Safety /// /// `coder` possibly has further requirements. #[unsafe(method(initWithCoder:))] #[unsafe(method_family = init)] pub unsafe fn initWithCoder( this: Allocated, coder: &NSCoder, ) -> Option>; #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; ); } /// Methods declared on superclass `NSSet`. impl NSCountedSet { extern_methods!( /// # Safety /// /// `objects` must be a valid pointer or null. #[unsafe(method(initWithObjects:count:))] #[unsafe(method_family = init)] pub unsafe fn initWithObjects_count( this: Allocated, objects: *mut NonNull, cnt: NSUInteger, ) -> Retained; ); } /// Methods declared on superclass `NSObject`. impl NSCountedSet { extern_methods!( #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSCountedSet { #[inline] fn default_retained() -> Retained { Self::new() } }