1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use Span;
use std::result;

pub trait WithSpan {
    /// Add additional position information, if it's not already present.
    fn with_span<E: Into<Span>>(self, span: E) -> Self;
}

impl<T, E> WithSpan for result::Result<T, E>
where
    E: WithSpan,
{
    fn with_span<P: Into<Span>>(self, span: P) -> Self {
        self.map_err(|e| e.with_span(span))
    }
}