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