objc2_core_services/generated/OSServices/
CSIdentityAuthority.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentityauthority?language=objc)
13#[doc(alias = "CSIdentityAuthorityRef")]
14#[repr(C)]
15pub struct CSIdentityAuthority {
16    inner: [u8; 0],
17    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21    unsafe impl CSIdentityAuthority {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25    unsafe impl RefEncode<"__CSIdentityAuthority"> for CSIdentityAuthority {}
26);
27
28unsafe impl ConcreteType for CSIdentityAuthority {
29    #[doc(alias = "CSIdentityAuthorityGetTypeID")]
30    #[inline]
31    fn type_id() -> CFTypeID {
32        extern "C-unwind" {
33            fn CSIdentityAuthorityGetTypeID() -> CFTypeID;
34        }
35        unsafe { CSIdentityAuthorityGetTypeID() }
36    }
37}
38
39#[inline]
40pub unsafe extern "C-unwind" fn CSGetDefaultIdentityAuthority(
41) -> Option<CFRetained<CSIdentityAuthority>> {
42    extern "C-unwind" {
43        fn CSGetDefaultIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
44    }
45    let ret = unsafe { CSGetDefaultIdentityAuthority() };
46    ret.map(|ret| unsafe { CFRetained::retain(ret) })
47}
48
49#[inline]
50pub unsafe extern "C-unwind" fn CSGetLocalIdentityAuthority(
51) -> Option<CFRetained<CSIdentityAuthority>> {
52    extern "C-unwind" {
53        fn CSGetLocalIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
54    }
55    let ret = unsafe { CSGetLocalIdentityAuthority() };
56    ret.map(|ret| unsafe { CFRetained::retain(ret) })
57}
58
59#[inline]
60pub unsafe extern "C-unwind" fn CSGetManagedIdentityAuthority(
61) -> Option<CFRetained<CSIdentityAuthority>> {
62    extern "C-unwind" {
63        fn CSGetManagedIdentityAuthority() -> Option<NonNull<CSIdentityAuthority>>;
64    }
65    let ret = unsafe { CSGetManagedIdentityAuthority() };
66    ret.map(|ret| unsafe { CFRetained::retain(ret) })
67}
68
69impl CSIdentityAuthority {
70    #[doc(alias = "CSIdentityAuthorityCopyLocalizedName")]
71    #[inline]
72    pub unsafe fn localized_name(&self) -> Option<CFRetained<CFString>> {
73        extern "C-unwind" {
74            fn CSIdentityAuthorityCopyLocalizedName(
75                authority: &CSIdentityAuthority,
76            ) -> Option<NonNull<CFString>>;
77        }
78        let ret = unsafe { CSIdentityAuthorityCopyLocalizedName(self) };
79        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
80    }
81}
82
83#[deprecated = "renamed to `CSIdentityAuthority::localized_name`"]
84#[inline]
85pub unsafe extern "C-unwind" fn CSIdentityAuthorityCopyLocalizedName(
86    authority: &CSIdentityAuthority,
87) -> Option<CFRetained<CFString>> {
88    extern "C-unwind" {
89        fn CSIdentityAuthorityCopyLocalizedName(
90            authority: &CSIdentityAuthority,
91        ) -> Option<NonNull<CFString>>;
92    }
93    let ret = unsafe { CSIdentityAuthorityCopyLocalizedName(authority) };
94    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
95}