objc2-core-ml 0.3.2

Bindings to the CoreML framework
Documentation
//! 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);
}