objc2_foundation/generated/
NSNull.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnull?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSNull;
15);
16
17unsafe impl Send for NSNull {}
18
19unsafe impl Sync for NSNull {}
20
21#[cfg(feature = "objc2-core-foundation")]
22impl AsRef<NSNull> for CFNull {
23    #[inline]
24    fn as_ref(&self) -> &NSNull {
25        unsafe { &*((self as *const Self).cast()) }
26    }
27}
28
29#[cfg(feature = "objc2-core-foundation")]
30impl AsRef<CFNull> for NSNull {
31    #[inline]
32    fn as_ref(&self) -> &CFNull {
33        unsafe { &*((self as *const Self).cast()) }
34    }
35}
36
37#[cfg(feature = "NSObject")]
38extern_conformance!(
39    unsafe impl NSCoding for NSNull {}
40);
41
42#[cfg(feature = "NSObject")]
43extern_conformance!(
44    unsafe impl NSCopying for NSNull {}
45);
46
47#[cfg(feature = "NSObject")]
48unsafe impl CopyingHelper for NSNull {
49    type Result = Self;
50}
51
52extern_conformance!(
53    unsafe impl NSObjectProtocol for NSNull {}
54);
55
56#[cfg(feature = "NSObject")]
57extern_conformance!(
58    unsafe impl NSSecureCoding for NSNull {}
59);
60
61impl NSNull {
62    extern_methods!(
63        #[unsafe(method(null))]
64        #[unsafe(method_family = none)]
65        pub fn null() -> Retained<NSNull>;
66    );
67}
68
69/// Methods declared on superclass `NSObject`.
70impl NSNull {
71    extern_methods!(
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub fn init(this: Allocated<Self>) -> Retained<Self>;
75
76        #[unsafe(method(new))]
77        #[unsafe(method_family = new)]
78        pub fn new() -> Retained<Self>;
79    );
80}
81
82impl DefaultRetained for NSNull {
83    #[inline]
84    fn default_retained() -> Retained<Self> {
85        Self::new()
86    }
87}