ito_common/id/error.rs
1//! Identifier parse error type.
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4/// Error returned when parsing an Ito identifier fails.
5pub struct IdParseError {
6 /// Human-readable error message.
7 pub error: String,
8
9 /// Optional hint describing a common fix.
10 pub hint: Option<String>,
11}
12
13impl IdParseError {
14 /// Build a parse error with an optional remediation hint.
15 pub(crate) fn new(error: impl Into<String>, hint: Option<impl Into<String>>) -> Self {
16 Self {
17 error: error.into(),
18 hint: hint.map(|h| h.into()),
19 }
20 }
21}