objc2_core_ml/generated/
MLModelError.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10    /// [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodelerrordomain?language=objc)
11    pub static MLModelErrorDomain: &'static NSString;
12}
13
14/// MLModelError defines the set of MLModel related error codes.
15///
16/// The framework communicates the error code to the application through NSError's code property. The
17/// application could use the error code to present an helpful error message to the user or to
18/// diagnose the problem.
19///
20/// See also NSError's localizedDescription property, which often contains more detailed information.
21///
22/// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodelerror?language=objc)
23// NS_ENUM
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct MLModelError(pub NSInteger);
27impl MLModelError {
28    /// Core ML throws/returns this error when the framework encounters an generic error.
29    ///
30    /// The typical cause for this error is an unexpected framework level problem.
31    #[doc(alias = "MLModelErrorGeneric")]
32    pub const Generic: Self = Self(0);
33    /// Core ML throws/returns this error when the model client, typically an application, sends
34    /// the wrong feature type to a model's input.
35    ///
36    /// The typical cause for this error is a programming mistake.
37    ///
38    /// For example, a prediction method will throw/return the error when the caller passes an image
39    /// to a model's input that expects an `MLMultiArray`.
40    #[doc(alias = "MLModelErrorFeatureType")]
41    pub const FeatureType: Self = Self(1);
42    /// Core ML throws/returns this error when the framework encounters some I/O problem, most
43    /// likely a file I/O problem.
44    ///
45    /// For example, a model loading will throw/return the error when the caller requests a
46    /// non-existing model URL.
47    #[doc(alias = "MLModelErrorIO")]
48    pub const IO: Self = Self(3);
49    /// Core ML throws/returns this error when the framework encounters an error in the custom
50    /// layer subsystem.
51    ///
52    /// The typical cause for this error is a programming mistake.
53    ///
54    /// For example, a prediction method will throw/return the error when it fails to find the custom
55    /// layer implementation.
56    #[doc(alias = "MLModelErrorCustomLayer")]
57    pub const CustomLayer: Self = Self(4);
58    /// Core ML throws/returns this error when the framework encounters an error in the custom
59    /// model subsystem.
60    ///
61    /// The typical cause for this error is a programming mistake.
62    ///
63    /// For example, a prediction method will throw/return the error when it fails to find the custom
64    /// model implementation.
65    #[doc(alias = "MLModelErrorCustomModel")]
66    pub const CustomModel: Self = Self(5);
67    /// Core ML throws/returns this error when the framework encounters an error while performing
68    /// the on-device model update.
69    ///
70    /// For example, the framework will throw/return the error when it fails to save the updated model.
71    #[doc(alias = "MLModelErrorUpdate")]
72    pub const Update: Self = Self(6);
73    /// Core ML throws/returns this error when the model client, typically an application, queries
74    /// an unsupported model parameter (see MLParameterKey).
75    ///
76    /// The typical cause for this error is a programming mistake.
77    #[doc(alias = "MLModelErrorParameters")]
78    pub const Parameters: Self = Self(7);
79    /// Core ML throws/returns this error when the framework fails to download the model decryption
80    /// key.
81    ///
82    /// The typical cause for this error is a network connection issue to the key server.
83    #[doc(alias = "MLModelErrorModelDecryptionKeyFetch")]
84    pub const ModelDecryptionKeyFetch: Self = Self(8);
85    /// Core ML throws/returns this error when the framework encounters an error in the model
86    /// decryption subsystem.
87    ///
88    /// The typical cause for this error is in the key server configuration and the client application
89    /// cannot do much about it.
90    ///
91    /// For example, a model loading method will throw/return the error when it uses incorrect model
92    /// decryption key.
93    #[doc(alias = "MLModelErrorModelDecryption")]
94    pub const ModelDecryption: Self = Self(9);
95    /// Core ML throws/returns this error when the framework encounters an error in the model
96    /// collection deployment subsystem.
97    ///
98    /// The typical cause for this error is the network connectability issue to the model deployment
99    /// server.
100    #[doc(alias = "MLModelErrorModelCollection")]
101    pub const ModelCollection: Self = Self(10);
102    /// Core ML throws/returns this error when the prediction is cancelled prior to completing.
103    #[doc(alias = "MLModelErrorPredictionCancelled")]
104    pub const PredictionCancelled: Self = Self(11);
105}
106
107unsafe impl Encode for MLModelError {
108    const ENCODING: Encoding = NSInteger::ENCODING;
109}
110
111unsafe impl RefEncode for MLModelError {
112    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
113}