Allow extracting the location of the error
This commit is contained in:
parent
bac92cdfad
commit
26d39b3a15
|
@ -1063,6 +1063,11 @@ impl<'a> Deserializer<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
|
/// Produces a (line, column) pair of the position of the error if available
|
||||||
|
pub fn line_col(&self) -> Option<(usize, usize)> {
|
||||||
|
self.inner.line.map(|line| (line, self.inner.col))
|
||||||
|
}
|
||||||
|
|
||||||
fn from_kind(kind: ErrorKind) -> Error {
|
fn from_kind(kind: ErrorKind) -> Error {
|
||||||
Error {
|
Error {
|
||||||
inner: Box::new(ErrorInner {
|
inner: Box::new(ErrorInner {
|
||||||
|
|
Loading…
Reference in a new issue