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/// Feature value constraints for specific types
79impl MLFeatureDescription {
80    extern_methods!(
81        #[cfg(feature = "MLMultiArrayConstraint")]
82        /// Constraint when type == MLFeatureTypeMultiArray, nil otherwise
83        #[unsafe(method(multiArrayConstraint))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn multiArrayConstraint(&self) -> Option<Retained<MLMultiArrayConstraint>>;
86
87        #[cfg(feature = "MLImageConstraint")]
88        /// Constraint when type == MLFeatureTypeImage, nil otherwise
89        #[unsafe(method(imageConstraint))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn imageConstraint(&self) -> Option<Retained<MLImageConstraint>>;
92
93        #[cfg(feature = "MLDictionaryConstraint")]
94        /// Constraint when type == MLFeatureTypeDictionary, nil otherwise
95        #[unsafe(method(dictionaryConstraint))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn dictionaryConstraint(&self) -> Option<Retained<MLDictionaryConstraint>>;
98
99        #[cfg(feature = "MLSequenceConstraint")]
100        /// Constraint when type == MLFeatureTypeSequence, nil otherwise
101        #[unsafe(method(sequenceConstraint))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn sequenceConstraint(&self) -> Option<Retained<MLSequenceConstraint>>;
104
105        #[cfg(feature = "MLStateConstraint")]
106        /// The state feature value constraint.
107        ///
108        /// The property has a value when `.type == MLFeatureTypeState`.
109        #[unsafe(method(stateConstraint))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn stateConstraint(&self) -> Option<Retained<MLStateConstraint>>;
112    );
113}