oak_highlight/errors/
mod.rs

1use oak_core::errors::OakError;
2use std::string::String;
3
4/// 扩展 ParseError 以支持高亮相关的错误
5/// 通过为 ParseError 实现扩展方法来添加高亮特定的错误类型
6pub trait ParseErrorExtHighlightExt {
7    /// 创建无效主题错误
8    fn invalid_theme(message: impl Into<String>) -> OakError;
9
10    /// 创建不支持格式错误
11    fn unsupported_format(format: impl Into<String>) -> OakError;
12
13    /// 创建颜色解析错误
14    fn color_parse_error(color: impl Into<String>) -> OakError;
15}
16
17impl ParseErrorExtHighlightExt for OakError {
18    fn invalid_theme(_message: impl Into<String>) -> OakError {
19        todo!()
20    }
21
22    fn unsupported_format(_format: impl Into<String>) -> OakError {
23        todo!()
24    }
25
26    fn color_parse_error(_color: impl Into<String>) -> OakError {
27        todo!()
28    }
29}
30
31/// 高亮结果类型 - 现在直接使用 ParseError
32pub type HighlightResult<T> = Result<T, OakError>;