diff options
author | Alex Crichton <alex@alexcrichton.com> | 2017-05-09 10:25:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 10:25:05 -0500 |
commit | f94dc8d69b22f330e6be19882f2f02e09895f18f (patch) | |
tree | 1ae1dc044221a582d14357df09e29bc0576ce4f0 | |
parent | 58f51ef03b88e06745c4113e13ea2738e1af247d (diff) | |
parent | cd733c7aff4468ff7a860dbc78ef20717e08b103 (diff) | |
download | milf-rs-f94dc8d69b22f330e6be19882f2f02e09895f18f.tar.gz milf-rs-f94dc8d69b22f330e6be19882f2f02e09895f18f.zip |
Merge pull request #170 from oli-obk/patch-1
Allow extracting the location of the error
-rw-r--r-- | src/de.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1063,6 +1063,13 @@ impl<'a> Deserializer<'a> { } impl Error { + /// Produces a (line, column) pair of the position of the error if available + /// + /// All indexes are 0-based. + pub fn line_col(&self) -> Option<(usize, usize)> { + self.inner.line.map(|line| (line, self.inner.col)) + } + fn from_kind(kind: ErrorKind) -> Error { Error { inner: Box::new(ErrorInner { |