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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodelerrordomain?language=objc)
pub static MLModelErrorDomain: &'static NSString;
}
/// MLModelError defines the set of MLModel related error codes.
///
/// The framework communicates the error code to the application through NSError's code property. The
/// application could use the error code to present an helpful error message to the user or to
/// diagnose the problem.
///
/// See also NSError's localizedDescription property, which often contains more detailed information.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodelerror?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MLModelError(pub NSInteger);
impl MLModelError {
/// Core ML throws/returns this error when the framework encounters an generic error.
///
/// The typical cause for this error is an unexpected framework level problem.
#[doc(alias = "MLModelErrorGeneric")]
pub const Generic: Self = Self(0);
/// Core ML throws/returns this error when the model client, typically an application, sends
/// the wrong feature type to a model's input.
///
/// The typical cause for this error is a programming mistake.
///
/// For example, a prediction method will throw/return the error when the caller passes an image
/// to a model's input that expects an `MLMultiArray`.
#[doc(alias = "MLModelErrorFeatureType")]
pub const FeatureType: Self = Self(1);
/// Core ML throws/returns this error when the framework encounters some I/O problem, most
/// likely a file I/O problem.
///
/// For example, a model loading will throw/return the error when the caller requests a
/// non-existing model URL.
#[doc(alias = "MLModelErrorIO")]
pub const IO: Self = Self(3);
/// Core ML throws/returns this error when the framework encounters an error in the custom
/// layer subsystem.
///
/// The typical cause for this error is a programming mistake.
///
/// For example, a prediction method will throw/return the error when it fails to find the custom
/// layer implementation.
#[doc(alias = "MLModelErrorCustomLayer")]
pub const CustomLayer: Self = Self(4);
/// Core ML throws/returns this error when the framework encounters an error in the custom
/// model subsystem.
///
/// The typical cause for this error is a programming mistake.
///
/// For example, a prediction method will throw/return the error when it fails to find the custom
/// model implementation.
#[doc(alias = "MLModelErrorCustomModel")]
pub const CustomModel: Self = Self(5);
/// Core ML throws/returns this error when the framework encounters an error while performing
/// the on-device model update.
///
/// For example, the framework will throw/return the error when it fails to save the updated model.
#[doc(alias = "MLModelErrorUpdate")]
pub const Update: Self = Self(6);
/// Core ML throws/returns this error when the model client, typically an application, queries
/// an unsupported model parameter (see MLParameterKey).
///
/// The typical cause for this error is a programming mistake.
#[doc(alias = "MLModelErrorParameters")]
pub const Parameters: Self = Self(7);
/// Core ML throws/returns this error when the framework fails to download the model decryption
/// key.
///
/// The typical cause for this error is a network connection issue to the key server.
#[doc(alias = "MLModelErrorModelDecryptionKeyFetch")]
pub const ModelDecryptionKeyFetch: Self = Self(8);
/// Core ML throws/returns this error when the framework encounters an error in the model
/// decryption subsystem.
///
/// The typical cause for this error is in the key server configuration and the client application
/// cannot do much about it.
///
/// For example, a model loading method will throw/return the error when it uses incorrect model
/// decryption key.
#[doc(alias = "MLModelErrorModelDecryption")]
pub const ModelDecryption: Self = Self(9);
/// Core ML throws/returns this error when the framework encounters an error in the model
/// collection deployment subsystem.
///
/// The typical cause for this error is the network connectability issue to the model deployment
/// server.
#[doc(alias = "MLModelErrorModelCollection")]
pub const ModelCollection: Self = Self(10);
/// Core ML throws/returns this error when the prediction is cancelled prior to completing.
#[doc(alias = "MLModelErrorPredictionCancelled")]
pub const PredictionCancelled: Self = Self(11);
}
unsafe impl Encode for MLModelError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for MLModelError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}