vosk/recognition/
mod.rs

1use std::os::raw::c_int;
2
3#[cfg(feature = "batch")]
4mod batch;
5mod errors;
6mod results;
7mod sequential;
8
9#[cfg(feature = "batch")]
10pub use batch::BatchRecognizer;
11pub use errors::*;
12pub use results::*;
13pub use sequential::Recognizer;
14
15#[derive(Debug, Clone, Copy, PartialEq, Eq)]
16/// State of the decodification after processing a chunk of data.
17pub enum DecodingState {
18    /// Silence has occured and you can retrieve a new utterance with the [`Recognizer::result`].
19    Finalized,
20    /// Decoding still continues.
21    Running,
22    /// Decoding failed in some way.
23    Failed,
24}
25
26impl DecodingState {
27    /// Returns the variant that corresponds to `value` in C.
28    pub(self) fn from_c_int(value: c_int) -> Self {
29        match value {
30            1 => Self::Finalized,
31            0 => Self::Running,
32            _ => Self::Failed,
33        }
34    }
35}