pub enum TableError {
MissingColumn {
line: usize,
},
InvalidField {
line: usize,
field: &'static str,
value: String,
},
SelfMapping {
line: usize,
ch: char,
},
DuplicateCandidate {
line: usize,
candidate: char,
owner: char,
},
DuplicateSource {
line: usize,
ch: char,
},
ChainedCandidate {
line: usize,
candidate: char,
},
}Expand description
映射表解析失败的原因。每条都对应 Table::parse 的一条校验规则,
并且都带上出错的行号,方便直接定位到 TSV 的那一行。
Variants§
MissingColumn
规则 1:这一行没有 Tab 分隔出的第二列
InvalidField
规则 2:原字和每个候选都必须是恰好一个 char
Fields
SelfMapping
规则 3:候选 ≠ 原字(映射到自身等于什么都没做,还会破坏反查)
DuplicateCandidate
规则 4:候选全局唯一(否则反查有歧义)
DuplicateSource
规则 5:同一原字不重复出现
ChainedCandidate
规则 6:候选不能同时是任何原字(否则 encode 后 decode 会套娃)
Trait Implementations§
Source§impl Debug for TableError
impl Debug for TableError
Source§impl Display for TableError
impl Display for TableError
Source§impl Error for TableError
impl Error for TableError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for TableError
impl RefUnwindSafe for TableError
impl Send for TableError
impl Sync for TableError
impl Unpin for TableError
impl UnsafeUnpin for TableError
impl UnwindSafe for TableError
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