SttError

Enum SttError 

Source
pub enum SttError {
    AudioFileError(String),
    FileNotFound(String),
    UnsupportedFormat(String),
    WhisperError(String),
    ModelLoadError(String),
    TranscriptionError(String),
    AudioProcessingError(String),
    ResamplingError(String),
    StreamError(String),
    ConfigError(String),
    IoError(Error),
    Other(String),
}
Expand description

STT模块的主要错误类型

Variants§

§

AudioFileError(String)

音频文件相关错误

§

FileNotFound(String)

文件未找到错误

§

UnsupportedFormat(String)

音频格式不支持

§

WhisperError(String)

Whisper模型相关错误

§

ModelLoadError(String)

模型加载失败

§

TranscriptionError(String)

转录失败

§

AudioProcessingError(String)

音频处理错误

§

ResamplingError(String)

音频重采样错误

§

StreamError(String)

流处理错误

§

ConfigError(String)

配置错误

§

IoError(Error)

IO错误

§

Other(String)

其他错误

Implementations§

Source§

impl SttError

错误辅助函数

Source

pub fn file_not_found<S: Into<String>>(path: S) -> Self

创建文件未找到错误

Source

pub fn unsupported_format<S: Into<String>>(format: S) -> Self

创建不支持格式错误

Source

pub fn model_load_error<S: Into<String>>(msg: S) -> Self

创建模型加载错误

Source

pub fn transcription_error<S: Into<String>>(msg: S) -> Self

创建转录错误

Source

pub fn config_error<S: Into<String>>(msg: S) -> Self

创建配置错误

Source

pub fn other<S: Into<String>>(msg: S) -> Self

创建其他错误

Trait Implementations§

Source§

impl Debug for SttError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SttError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SttError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for SttError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for SttError

从hound错误转换

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ResampleError> for SttError

从rubato错误转换

Source§

fn from(err: ResampleError) -> Self

Converts to this type from the input type.
Source§

impl From<WhisperError> for SttError

从whisper-rs错误转换

Source§

fn from(err: WhisperError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.