objc2_core_ml/generated/
MLFeatureDescription.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_class!(
10    /// Description of a feature
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlfeaturedescription?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct MLFeatureDescription;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for MLFeatureDescription {}
20);
21
22extern_conformance!(
23    unsafe impl NSCopying for MLFeatureDescription {}
24);
25
26unsafe impl CopyingHelper for MLFeatureDescription {
27    type Result = Self;
28}
29
30extern_conformance!(
31    unsafe impl NSObjectProtocol for MLFeatureDescription {}
32);
33
34extern_conformance!(
35    unsafe impl NSSecureCoding for MLFeatureDescription {}
36);
37
38impl MLFeatureDescription {
39    extern_methods!(
40        /// Name of feature
41        #[unsafe(method(name))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn name(&self) -> Retained<NSString>;
44
45        #[cfg(feature = "MLFeatureType")]
46        /// Type of data
47        #[unsafe(method(type))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn r#type(&self) -> MLFeatureType;
50
51        /// Whether this feature can take an undefined value or not
52        #[unsafe(method(isOptional))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn isOptional(&self) -> bool;
55
56        #[cfg(feature = "MLFeatureValue")]
57        /// Check if MLFeatureValue is valid based on this description
58        #[unsafe(method(isAllowedValue:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn isAllowedValue(&self, value: &MLFeatureValue) -> bool;
61    );
62}
63
64/// Methods declared on superclass `NSObject`.
65impl MLFeatureDescription {
66    extern_methods!(
67        #[unsafe(method(init))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
70
71        #[unsafe(method(new))]
72        #[unsafe(method_family = new)]
73        pub unsafe fn new() -> Retained<Self>;
74    );
75}
76
77/// MLFeatureValueConstraints.
78///
79/// Feature value constraints for specific types
80impl MLFeatureDescription {
81    extern_methods!(
82        #[cfg(feature = "MLMultiArrayConstraint")]
83        /// Constraint when type == MLFeatureTypeMultiArray, nil otherwise
84        #[unsafe(method(multiArrayConstraint))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn multiArrayConstraint(&self) -> Option<Retained<MLMultiArrayConstraint>>;
87
88        #[cfg(feature = "MLImageConstraint")]
89        /// Constraint when type == MLFeatureTypeImage, nil otherwise
90        #[unsafe(method(imageConstraint))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn imageConstraint(&self) -> Option<Retained<MLImageConstraint>>;
93
94        #[cfg(feature = "MLDictionaryConstraint")]
95        /// Constraint when type == MLFeatureTypeDictionary, nil otherwise
96        #[unsafe(method(dictionaryConstraint))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn dictionaryConstraint(&self) -> Option<Retained<MLDictionaryConstraint>>;
99
100        #[cfg(feature = "MLSequenceConstraint")]
101        /// Constraint when type == MLFeatureTypeSequence, nil otherwise
102        #[unsafe(method(sequenceConstraint))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn sequenceConstraint(&self) -> Option<Retained<MLSequenceConstraint>>;
105
106        #[cfg(feature = "MLStateConstraint")]
107        /// The state feature value constraint.
108        ///
109        /// The property has a value when `.type == MLFeatureTypeState`.
110        #[unsafe(method(stateConstraint))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn stateConstraint(&self) -> Option<Retained<MLStateConstraint>>;
113    );
114}