objc2_speech/generated/SFSpeechRecognitionResult.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 /// An object that contains the partial or final results of a speech recognition request.
11 ///
12 /// Use an `SFSpeechRecognitionResult` object to retrieve the results of a speech recognition request. You don't create these objects directly. Instead, the Speech framework creates them and passes them to the handler block or delegate object you specified when starting your speech recognition task.
13 ///
14 /// A speech recognition result object contains one or more ``transcriptions`` of the current utterance. Each transcription has a confidence rating indicating how likely it is to be correct. You can also get the transcription with the highest rating directly from the ``bestTranscription`` property.
15 ///
16 /// If you requested partial results from the speech recognizer, the transcriptions may represent only part of the total audio content. Use the ``isFinal`` property to determine if the request contains partial or final results.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/speech/sfspeechrecognitionresult?language=objc)
19 #[unsafe(super(NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 pub struct SFSpeechRecognitionResult;
22);
23
24extern_conformance!(
25 unsafe impl NSCoding for SFSpeechRecognitionResult {}
26);
27
28extern_conformance!(
29 unsafe impl NSCopying for SFSpeechRecognitionResult {}
30);
31
32unsafe impl CopyingHelper for SFSpeechRecognitionResult {
33 type Result = Self;
34}
35
36extern_conformance!(
37 unsafe impl NSObjectProtocol for SFSpeechRecognitionResult {}
38);
39
40extern_conformance!(
41 unsafe impl NSSecureCoding for SFSpeechRecognitionResult {}
42);
43
44impl SFSpeechRecognitionResult {
45 extern_methods!(
46 #[cfg(feature = "SFTranscription")]
47 /// The transcription with the highest confidence level.
48 #[unsafe(method(bestTranscription))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn bestTranscription(&self) -> Retained<SFTranscription>;
51
52 #[cfg(feature = "SFTranscription")]
53 /// An array of potential transcriptions, sorted in descending order of confidence.
54 ///
55 /// All transcriptions correspond to the same utterance, which can be a partial or final result of the overall request. The first transcription in the array has the highest confidence rating, followed by transcriptions with decreasing confidence ratings.
56 #[unsafe(method(transcriptions))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn transcriptions(&self) -> Retained<NSArray<SFTranscription>>;
59
60 /// A Boolean value that indicates whether speech recognition is complete and whether the transcriptions are final.
61 ///
62 /// When a speech recognition request is final, its transcriptions don't change.
63 #[unsafe(method(isFinal))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn isFinal(&self) -> bool;
66
67 #[cfg(feature = "SFSpeechRecognitionMetadata")]
68 /// An object that contains the metadata results for a speech recognition request.
69 #[unsafe(method(speechRecognitionMetadata))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn speechRecognitionMetadata(
72 &self,
73 ) -> Option<Retained<SFSpeechRecognitionMetadata>>;
74 );
75}
76
77/// Methods declared on superclass `NSObject`.
78impl SFSpeechRecognitionResult {
79 extern_methods!(
80 #[unsafe(method(init))]
81 #[unsafe(method_family = init)]
82 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84 #[unsafe(method(new))]
85 #[unsafe(method_family = new)]
86 pub unsafe fn new() -> Retained<Self>;
87 );
88}