objc2_foundation/generated/
NSEnumerator.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_protocol!(
9 pub unsafe trait NSFastEnumeration {
11 #[unsafe(method(countByEnumeratingWithState:objects:count:))]
12 #[unsafe(method_family = none)]
13 unsafe fn countByEnumeratingWithState_objects_count(
14 &self,
15 state: NonNull<NSFastEnumerationState>,
16 buffer: NonNull<*mut AnyObject>,
17 len: NSUInteger,
18 ) -> NSUInteger;
19 }
20);
21
22extern_class!(
23 #[unsafe(super(NSObject))]
25 #[derive(Debug, PartialEq, Eq, Hash)]
26 pub struct NSEnumerator<ObjectType: ?Sized = AnyObject>;
27);
28
29unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSEnumerator<ObjectType> {}
30
31unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSEnumerator<ObjectType> {}
32
33impl<ObjectType: Message> NSEnumerator<ObjectType> {
34 extern_methods!(
35 #[unsafe(method(nextObject))]
36 #[unsafe(method_family = none)]
37 pub fn nextObject(&self) -> Option<Retained<ObjectType>>;
38 );
39}
40
41impl<ObjectType: Message> NSEnumerator<ObjectType> {
43 extern_methods!(
44 #[unsafe(method(init))]
45 #[unsafe(method_family = init)]
46 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
47
48 #[unsafe(method(new))]
49 #[unsafe(method_family = new)]
50 pub unsafe fn new() -> Retained<Self>;
51 );
52}
53
54impl<ObjectType: Message> NSEnumerator<ObjectType> {
56 extern_methods!(
57 #[cfg(feature = "NSArray")]
58 #[unsafe(method(allObjects))]
59 #[unsafe(method_family = none)]
60 pub fn allObjects(&self) -> Retained<NSArray<ObjectType>>;
61 );
62}