objc2_foundation/generated/
NSNotificationQueue.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
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspostingstyle?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSPostingStyle(pub NSUInteger);
14impl NSPostingStyle {
15    #[doc(alias = "NSPostWhenIdle")]
16    pub const PostWhenIdle: Self = Self(1);
17    #[doc(alias = "NSPostASAP")]
18    pub const PostASAP: Self = Self(2);
19    #[doc(alias = "NSPostNow")]
20    pub const PostNow: Self = Self(3);
21}
22
23unsafe impl Encode for NSPostingStyle {
24    const ENCODING: Encoding = NSUInteger::ENCODING;
25}
26
27unsafe impl RefEncode for NSPostingStyle {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnotificationcoalescing?language=objc)
32// NS_OPTIONS
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct NSNotificationCoalescing(pub NSUInteger);
36bitflags::bitflags! {
37    impl NSNotificationCoalescing: NSUInteger {
38        #[doc(alias = "NSNotificationNoCoalescing")]
39        const NoCoalescing = 0;
40        #[doc(alias = "NSNotificationCoalescingOnName")]
41        const CoalescingOnName = 1;
42        #[doc(alias = "NSNotificationCoalescingOnSender")]
43        const CoalescingOnSender = 2;
44    }
45}
46
47unsafe impl Encode for NSNotificationCoalescing {
48    const ENCODING: Encoding = NSUInteger::ENCODING;
49}
50
51unsafe impl RefEncode for NSNotificationCoalescing {
52    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55extern_class!(
56    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnotificationqueue?language=objc)
57    #[unsafe(super(NSObject))]
58    #[derive(Debug, PartialEq, Eq, Hash)]
59    pub struct NSNotificationQueue;
60);
61
62extern_conformance!(
63    unsafe impl NSObjectProtocol for NSNotificationQueue {}
64);
65
66impl NSNotificationQueue {
67    extern_methods!(
68        #[unsafe(method(defaultQueue))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn defaultQueue() -> Retained<NSNotificationQueue>;
71
72        #[cfg(feature = "NSNotification")]
73        #[unsafe(method(initWithNotificationCenter:))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn initWithNotificationCenter(
76            this: Allocated<Self>,
77            notification_center: &NSNotificationCenter,
78        ) -> Retained<Self>;
79
80        #[cfg(feature = "NSNotification")]
81        #[unsafe(method(enqueueNotification:postingStyle:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn enqueueNotification_postingStyle(
84            &self,
85            notification: &NSNotification,
86            posting_style: NSPostingStyle,
87        );
88
89        #[cfg(all(
90            feature = "NSArray",
91            feature = "NSNotification",
92            feature = "NSObjCRuntime",
93            feature = "NSString"
94        ))]
95        #[unsafe(method(enqueueNotification:postingStyle:coalesceMask:forModes:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn enqueueNotification_postingStyle_coalesceMask_forModes(
98            &self,
99            notification: &NSNotification,
100            posting_style: NSPostingStyle,
101            coalesce_mask: NSNotificationCoalescing,
102            modes: Option<&NSArray<NSRunLoopMode>>,
103        );
104
105        #[cfg(feature = "NSNotification")]
106        #[unsafe(method(dequeueNotificationsMatching:coalesceMask:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn dequeueNotificationsMatching_coalesceMask(
109            &self,
110            notification: &NSNotification,
111            coalesce_mask: NSUInteger,
112        );
113    );
114}
115
116/// Methods declared on superclass `NSObject`.
117impl NSNotificationQueue {
118    extern_methods!(
119        #[unsafe(method(init))]
120        #[unsafe(method_family = init)]
121        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
122
123        #[unsafe(method(new))]
124        #[unsafe(method_family = new)]
125        pub unsafe fn new() -> Retained<Self>;
126    );
127}