objc2_core_services/generated/SearchKit/
SKDocument.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/skdocument?language=objc)
9#[doc(alias = "SKDocumentRef")]
10pub type SKDocument = CFType;
11
12#[inline]
13pub extern "C-unwind" fn SKDocumentGetTypeID() -> CFTypeID {
14    extern "C-unwind" {
15        fn SKDocumentGetTypeID() -> CFTypeID;
16    }
17    unsafe { SKDocumentGetTypeID() }
18}
19
20/// # Safety
21///
22/// `in_url` might not allow `None`.
23#[inline]
24pub unsafe extern "C-unwind" fn SKDocumentCreateWithURL(
25    in_url: Option<&CFURL>,
26) -> Option<CFRetained<SKDocument>> {
27    extern "C-unwind" {
28        fn SKDocumentCreateWithURL(in_url: Option<&CFURL>) -> Option<NonNull<SKDocument>>;
29    }
30    let ret = unsafe { SKDocumentCreateWithURL(in_url) };
31    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
32}
33
34/// # Safety
35///
36/// `in_document` should be of the correct type.
37#[inline]
38pub unsafe extern "C-unwind" fn SKDocumentCopyURL(
39    in_document: &SKDocument,
40) -> Option<CFRetained<CFURL>> {
41    extern "C-unwind" {
42        fn SKDocumentCopyURL(in_document: &SKDocument) -> Option<NonNull<CFURL>>;
43    }
44    let ret = unsafe { SKDocumentCopyURL(in_document) };
45    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
46}
47
48/// # Safety
49///
50/// - `in_scheme` might not allow `None`.
51/// - `in_parent` should be of the correct type.
52/// - `in_parent` might not allow `None`.
53/// - `in_name` might not allow `None`.
54#[inline]
55pub unsafe extern "C-unwind" fn SKDocumentCreate(
56    in_scheme: Option<&CFString>,
57    in_parent: Option<&SKDocument>,
58    in_name: Option<&CFString>,
59) -> Option<CFRetained<SKDocument>> {
60    extern "C-unwind" {
61        fn SKDocumentCreate(
62            in_scheme: Option<&CFString>,
63            in_parent: Option<&SKDocument>,
64            in_name: Option<&CFString>,
65        ) -> Option<NonNull<SKDocument>>;
66    }
67    let ret = unsafe { SKDocumentCreate(in_scheme, in_parent, in_name) };
68    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
69}
70
71/// # Safety
72///
73/// `in_document` should be of the correct type.
74#[inline]
75pub unsafe extern "C-unwind" fn SKDocumentGetSchemeName(
76    in_document: &SKDocument,
77) -> Option<CFRetained<CFString>> {
78    extern "C-unwind" {
79        fn SKDocumentGetSchemeName(in_document: &SKDocument) -> Option<NonNull<CFString>>;
80    }
81    let ret = unsafe { SKDocumentGetSchemeName(in_document) };
82    ret.map(|ret| unsafe { CFRetained::retain(ret) })
83}
84
85/// # Safety
86///
87/// `in_document` should be of the correct type.
88#[inline]
89pub unsafe extern "C-unwind" fn SKDocumentGetName(
90    in_document: &SKDocument,
91) -> Option<CFRetained<CFString>> {
92    extern "C-unwind" {
93        fn SKDocumentGetName(in_document: &SKDocument) -> Option<NonNull<CFString>>;
94    }
95    let ret = unsafe { SKDocumentGetName(in_document) };
96    ret.map(|ret| unsafe { CFRetained::retain(ret) })
97}
98
99/// # Safety
100///
101/// `in_document` should be of the correct type.
102#[inline]
103pub unsafe extern "C-unwind" fn SKDocumentGetParent(
104    in_document: &SKDocument,
105) -> Option<CFRetained<SKDocument>> {
106    extern "C-unwind" {
107        fn SKDocumentGetParent(in_document: &SKDocument) -> Option<NonNull<SKDocument>>;
108    }
109    let ret = unsafe { SKDocumentGetParent(in_document) };
110    ret.map(|ret| unsafe { CFRetained::retain(ret) })
111}