use runestick::Span;
pub(crate) trait ResultExt<T, E> {
fn with_span(self, span: Span) -> Result<T, WithSpan<E>>;
}
impl<T, E> ResultExt<T, E> for Result<T, E> {
fn with_span(self, span: Span) -> Result<T, WithSpan<E>> {
match self {
Ok(value) => Ok(value),
Err(error) => Err(WithSpan { error, span }),
}
}
}
pub(crate) struct WithSpan<E> {
pub(crate) span: Span,
pub(crate) error: E,
}