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_class!(
    /// A concrete convenience class conforming to MLFeatureProvider.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mldictionaryfeatureprovider?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MLDictionaryFeatureProvider;
);

#[cfg(feature = "MLFeatureProvider")]
extern_conformance!(
    unsafe impl MLFeatureProvider for MLDictionaryFeatureProvider {}
);

extern_conformance!(
    unsafe impl NSCoding for MLDictionaryFeatureProvider {}
);

extern_conformance!(
    unsafe impl NSFastEnumeration for MLDictionaryFeatureProvider {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for MLDictionaryFeatureProvider {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for MLDictionaryFeatureProvider {}
);

impl MLDictionaryFeatureProvider {
    extern_methods!(
        #[cfg(feature = "MLFeatureValue")]
        /// Dictionary holding the feature values
        #[unsafe(method(dictionary))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionary(&self) -> Retained<NSDictionary<NSString, MLFeatureValue>>;

        /// Create from a generic dictionary by converting all values to MLFeatureValues
        /// or from a dictionary with values already stored as MLFeatureValues.
        ///
        /// An error results if the values are not or cannot be represented as MLFeatureValues.
        ///
        /// # Safety
        ///
        /// `dictionary` generic should be of the correct type.
        #[unsafe(method(initWithDictionary:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDictionary_error(
            this: Allocated<Self>,
            dictionary: &NSDictionary<NSString, AnyObject>,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        #[cfg(feature = "MLFeatureValue")]
        /// Get the value for specified feature
        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectForKeyedSubscript(
            &self,
            feature_name: &NSString,
        ) -> Option<Retained<MLFeatureValue>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl MLDictionaryFeatureProvider {
    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>;
    );
}