br-ble 0.2.0

This is an Bluetooth
Documentation
macro_rules! object_ptr_wrapper {
    ($n:ident) => {
        #[derive(Clone, Copy, Debug)]
        #[repr(transparent)]
        pub struct $n(::std::ptr::NonNull<::objc::runtime::Object>);

        impl $n {
              /// # Safety
              /// 调用者必须确保对象在这个函数调用期间没有被释放或销毁。
            #[allow(dead_code)]
            pub unsafe fn wrap(v: impl crate::mac::platform::ObjectPtr) -> Self {
                Self(::std::ptr::NonNull::new(v.as_ptr()).unwrap())
            }

                /// # Safety
                /// 调用者必须确保对象在这个函数调用期间没有被释放或销毁。
            #[allow(dead_code)]
            pub unsafe fn wrap_nullable(v: *mut ::objc::runtime::Object) -> Option<Self> {
                ::std::ptr::NonNull::new(v).map(|v| Self(v))
            }

            #[allow(dead_code)]
            pub fn retain(self) -> crate::mac::platform::StrongPtr<Self> {
                unsafe { crate::mac::platform::StrongPtr::retain(self) }
            }
        }

        impl crate::mac::platform::ObjectPtr for $n {
            fn as_ptr(&self) -> *mut ::objc::runtime::Object {
                self.0.as_ptr()
            }
        }

        unsafe impl ::std::marker::Send for $n {}
        unsafe impl ::std::marker::Sync for $n {}
    };
}