1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A class representing the structure of a model.
///
/// ```text
/// // Load the model structure.
/// [MLModelStructure loadContentsOfURL:modelURL completionHandler:^(MLModelStructure * _Nullable modelStructure, NSError * _Nullable error) {
/// if (!modelStructure) {
/// // Handle error.
/// return;
/// }
/// if (modelStructure.neuralNetwork) {
/// // Examine Neural network model.
/// } else if (modelStructure.program) {
/// // Examine ML Program model.
/// } else if (modelStructure.pipeline) {
/// // Examine Pipeline model.
/// } else {
/// // The model type is something else.
/// }
/// }];
/// ```
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodelstructure?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MLModelStructure;
);
unsafe impl Send for MLModelStructure {}
unsafe impl Sync for MLModelStructure {}
extern_conformance!(
unsafe impl NSObjectProtocol for MLModelStructure {}
);
impl MLModelStructure {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[cfg(feature = "block2")]
/// Construct the model structure asynchronously given the location of its on-disk representation.
///
///
/// Parameter `url`: The location of its on-disk representation (.mlmodelc directory).
///
/// Parameter `handler`: When the model structure is constructed successfully or unsuccessfully, the completion handler is invoked with a valid MLModelStructure instance or NSError object.
#[unsafe(method(loadContentsOfURL:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadContentsOfURL_completionHandler(
url: &NSURL,
handler: &block2::DynBlock<dyn Fn(*mut MLModelStructure, *mut NSError)>,
);
#[cfg(all(feature = "MLModelAsset", feature = "block2"))]
/// Construct the model structure asynchronously given the model asset.
///
///
/// Parameter `asset`: The model asset.
///
/// Parameter `handler`: When the model structure is constructed successfully or unsuccessfully, the completion handler is invoked with a valid MLModelStructure instance or NSError object.
#[unsafe(method(loadModelAsset:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadModelAsset_completionHandler(
asset: &MLModelAsset,
handler: &block2::DynBlock<dyn Fn(*mut MLModelStructure, *mut NSError)>,
);
#[cfg(feature = "MLModelStructureNeuralNetwork")]
/// If the model is of NeuralNetwork type then it is the structure of the NeuralNetwork otherwise `nil`.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(neuralNetwork))]
#[unsafe(method_family = none)]
pub unsafe fn neuralNetwork(&self) -> Option<Retained<MLModelStructureNeuralNetwork>>;
#[cfg(feature = "MLModelStructureProgram")]
/// If the model is of ML Program type then it is the structure of the ML Program otherwise `nil`.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(program))]
#[unsafe(method_family = none)]
pub unsafe fn program(&self) -> Option<Retained<MLModelStructureProgram>>;
#[cfg(feature = "MLModelStructurePipeline")]
/// If the model is of Pipeline type then it is the structure of the Pipeline otherwise `nil`.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(pipeline))]
#[unsafe(method_family = none)]
pub unsafe fn pipeline(&self) -> Option<Retained<MLModelStructurePipeline>>;
);
}