rust_macios/foundation/
ns_null.rs

1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4    object,
5    objective_c_runtime::{
6        macros::interface_impl,
7        traits::{FromId, PNSObject},
8    },
9};
10
11object! {
12    /// Returns the singleton instance of NSNull.
13    unsafe pub struct NSNull;
14
15}
16
17#[interface_impl(NSObject)]
18impl NSNull {
19    /* Obtaining an instance
20     */
21
22    /// Returns the singleton instance of NSNull.
23    #[method]
24    pub fn null() -> NSNull {
25        unsafe { NSNull::from_id(msg_send![Self::m_class(), null]) }
26    }
27}