pub struct TypeError {
pub message: String,
pub code: String,
pub line: Option<usize>,
pub column: Option<usize>,
pub file_path: Option<String>,
pub suggestions: Vec<String>,
pub related_types: Vec<String>,
pub severity: TypeErrorSeverity,
}Expand description
类型错误
表示类型检查过程中发现的错误,包含错误信息、位置和建议修复方案。
Fields§
§message: String错误信息
code: String错误代码
line: Option<usize>错误位置(行号,从 1 开始)
column: Option<usize>错误位置(列号,从 1 开始)
file_path: Option<String>源文件路径
suggestions: Vec<String>建议修复方案
相关类型
severity: TypeErrorSeverity错误严重程度
Implementations§
Source§impl TypeError
impl TypeError
Sourcepub fn with_location(self, line: usize, column: usize) -> Self
pub fn with_location(self, line: usize, column: usize) -> Self
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
Sourcepub fn with_severity(self, severity: TypeErrorSeverity) -> Self
pub fn with_severity(self, severity: TypeErrorSeverity) -> Self
Trait Implementations§
impl Eq for TypeError
impl StructuralPartialEq for TypeError
Auto Trait Implementations§
impl Freeze for TypeError
impl RefUnwindSafe for TypeError
impl Send for TypeError
impl Sync for TypeError
impl Unpin for TypeError
impl UnsafeUnpin for TypeError
impl UnwindSafe for TypeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more