diff --git a/src/final_parser.rs b/src/final_parser.rs index e8781f4..51d9f21 100644 --- a/src/final_parser.rs +++ b/src/final_parser.rs @@ -72,6 +72,16 @@ impl RecreateContext for I { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct ByteOffset(pub usize); +impl Display for ByteOffset { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + if f.alternate() { + write!(f, "byte offset {}", self.0) + } else { + write!(f, "{}", self.0) + } + } +} + impl RecreateContext for ByteOffset { fn recreate_context(original_input: I, tail: I) -> Self { ByteOffset(original_input.offset(&tail))