bmatcher_core/compiler/error.rs
1use core::{
2 fmt::Debug,
3 ops::Range,
4};
5
6/// A PositionedError representing an error that is associated with a specific position in the given pattern.
7#[derive(Debug, PartialEq)]
8pub struct PositionedError<E: Debug + PartialEq> {
9 position: Range<usize>,
10 inner: E,
11}
12
13impl<E: Debug + PartialEq> PositionedError<E> {
14 pub fn new(position: Range<usize>, inner: E) -> Self {
15 Self { position, inner }
16 }
17
18 pub fn position(&self) -> &Range<usize> {
19 &self.position
20 }
21
22 pub fn inner(&self) -> &E {
23 &self.inner
24 }
25}