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
62unsafe impl NSObjectProtocol for NSNotificationQueue {}
63
64impl NSNotificationQueue {
65    extern_methods!(
66        #[unsafe(method(defaultQueue))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn defaultQueue() -> Retained<NSNotificationQueue>;
69
70        #[cfg(feature = "NSNotification")]
71        #[unsafe(method(initWithNotificationCenter:))]
72        #[unsafe(method_family = init)]
73        pub unsafe fn initWithNotificationCenter(
74            this: Allocated<Self>,
75            notification_center: &NSNotificationCenter,
76        ) -> Retained<Self>;
77
78        #[cfg(feature = "NSNotification")]
79        #[unsafe(method(enqueueNotification:postingStyle:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn enqueueNotification_postingStyle(
82            &self,
83            notification: &NSNotification,
84            posting_style: NSPostingStyle,
85        );
86
87        #[cfg(all(
88            feature = "NSArray",
89            feature = "NSNotification",
90            feature = "NSObjCRuntime",
91            feature = "NSString"
92        ))]
93        #[unsafe(method(enqueueNotification:postingStyle:coalesceMask:forModes:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn enqueueNotification_postingStyle_coalesceMask_forModes(
96            &self,
97            notification: &NSNotification,
98            posting_style: NSPostingStyle,
99            coalesce_mask: NSNotificationCoalescing,
100            modes: Option<&NSArray<NSRunLoopMode>>,
101        );
102
103        #[cfg(feature = "NSNotification")]
104        #[unsafe(method(dequeueNotificationsMatching:coalesceMask:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn dequeueNotificationsMatching_coalesceMask(
107            &self,
108            notification: &NSNotification,
109            coalesce_mask: NSUInteger,
110        );
111    );
112}
113
114/// Methods declared on superclass `NSObject`.
115impl NSNotificationQueue {
116    extern_methods!(
117        #[unsafe(method(init))]
118        #[unsafe(method_family = init)]
119        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121        #[unsafe(method(new))]
122        #[unsafe(method_family = new)]
123        pub unsafe fn new() -> Retained<Self>;
124    );
125}