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
29extern_conformance!(
30 unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSEnumerator<ObjectType> {}
31);
32
33extern_conformance!(
34 unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSEnumerator<ObjectType> {}
35);
36
37impl<ObjectType: Message> NSEnumerator<ObjectType> {
38 extern_methods!(
39 #[unsafe(method(nextObject))]
40 #[unsafe(method_family = none)]
41 pub fn nextObject(&self) -> Option<Retained<ObjectType>>;
42 );
43}
44
45impl<ObjectType: Message> NSEnumerator<ObjectType> {
47 extern_methods!(
48 #[unsafe(method(init))]
49 #[unsafe(method_family = init)]
50 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52 #[unsafe(method(new))]
53 #[unsafe(method_family = new)]
54 pub unsafe fn new() -> Retained<Self>;
55 );
56}
57
58impl<ObjectType: Message> NSEnumerator<ObjectType> {
60 extern_methods!(
61 #[cfg(feature = "NSArray")]
62 #[unsafe(method(allObjects))]
63 #[unsafe(method_family = none)]
64 pub fn allObjects(&self) -> Retained<NSArray<ObjectType>>;
65 );
66}