Result

Type Alias Result 

Source
pub type Result<T> = Result<T, Error>;
Expand description

统一结果类型别名

这是整个语音工具库的标准结果类型。所有公共函数都返回这个类型, 确保错误处理的一致性。

§示例

use voice_toolkit::Result;
 
fn process_data() -> Result<String> {
    // 处理逻辑
    Ok("处理完成".to_string())
}
 
fn main() {
    match process_data() {
        Ok(result) => println!("{}", result),
        Err(e) => println!("错误: {}", e),
    }
}

Aliased Type§

pub enum Result<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value