icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::Foundation::*;
use crate::Speech::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum SFSpeechRecognitionTaskState {
        SFSpeechRecognitionTaskStateStarting = 0,
        SFSpeechRecognitionTaskStateRunning = 1,
        SFSpeechRecognitionTaskStateFinishing = 2,
        SFSpeechRecognitionTaskStateCanceling = 3,
        SFSpeechRecognitionTaskStateCompleted = 4,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
    pub struct SFSpeechRecognitionTask;

    #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
    unsafe impl ClassType for SFSpeechRecognitionTask {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "Speech_SFSpeechRecognitionTask")]
unsafe impl NSObjectProtocol for SFSpeechRecognitionTask {}

extern_methods!(
    #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
    unsafe impl SFSpeechRecognitionTask {
        #[method(state)]
        pub unsafe fn state(&self) -> SFSpeechRecognitionTaskState;

        #[method(isFinishing)]
        pub unsafe fn isFinishing(&self) -> bool;

        #[method(finish)]
        pub unsafe fn finish(&self);

        #[method(isCancelled)]
        pub unsafe fn isCancelled(&self) -> bool;

        #[method(cancel)]
        pub unsafe fn cancel(&self);

        #[cfg(feature = "Foundation_NSError")]
        #[method_id(@__retain_semantics Other error)]
        pub unsafe fn error(&self) -> Option<Id<NSError>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
    unsafe impl SFSpeechRecognitionTask {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_protocol!(
    pub unsafe trait SFSpeechRecognitionTaskDelegate: NSObjectProtocol {
        #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
        #[optional]
        #[method(speechRecognitionDidDetectSpeech:)]
        unsafe fn speechRecognitionDidDetectSpeech(&self, task: &SFSpeechRecognitionTask);

        #[cfg(all(
            feature = "Speech_SFSpeechRecognitionTask",
            feature = "Speech_SFTranscription"
        ))]
        #[optional]
        #[method(speechRecognitionTask:didHypothesizeTranscription:)]
        unsafe fn speechRecognitionTask_didHypothesizeTranscription(
            &self,
            task: &SFSpeechRecognitionTask,
            transcription: &SFTranscription,
        );

        #[cfg(all(
            feature = "Speech_SFSpeechRecognitionResult",
            feature = "Speech_SFSpeechRecognitionTask"
        ))]
        #[optional]
        #[method(speechRecognitionTask:didFinishRecognition:)]
        unsafe fn speechRecognitionTask_didFinishRecognition(
            &self,
            task: &SFSpeechRecognitionTask,
            recognition_result: &SFSpeechRecognitionResult,
        );

        #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
        #[optional]
        #[method(speechRecognitionTaskFinishedReadingAudio:)]
        unsafe fn speechRecognitionTaskFinishedReadingAudio(&self, task: &SFSpeechRecognitionTask);

        #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
        #[optional]
        #[method(speechRecognitionTaskWasCancelled:)]
        unsafe fn speechRecognitionTaskWasCancelled(&self, task: &SFSpeechRecognitionTask);

        #[cfg(feature = "Speech_SFSpeechRecognitionTask")]
        #[optional]
        #[method(speechRecognitionTask:didFinishSuccessfully:)]
        unsafe fn speechRecognitionTask_didFinishSuccessfully(
            &self,
            task: &SFSpeechRecognitionTask,
            successfully: bool,
        );
    }

    unsafe impl ProtocolType for dyn SFSpeechRecognitionTaskDelegate {}
);