From 2c6021ffa738b38be9a51a6ba4872d018404afc1 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 11 Aug 2023 22:55:47 +0200 Subject: break!: rename PosTracker to PosTrackingReader --- src/spans.rs | 8 ++++---- tests/test_spans.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/spans.rs b/src/spans.rs index ee63dd3..4333bd1 100644 --- a/src/spans.rs +++ b/src/spans.rs @@ -7,7 +7,7 @@ //! * one for [`Range`] for when you do want to track spans //! //! To use the latter your reader however has to implement [`GetPos`]. -//! You can easily use any existing reader by wrapping it in the [`PosTracker`] struct +//! You can easily use any existing reader by wrapping it in the [`PosTrackingReader`] struct //! which implements the [`GetPos`] trait and takes care of tracking the current position. use std::ops::Range; @@ -21,14 +21,14 @@ pub trait GetPos { } /// Wraps a [`Reader`] so that it implements [`GetPos`]. -pub struct PosTracker { +pub struct PosTrackingReader { /// The wrapped reader. pub reader: R, /// The current position. pub position: usize, } -impl GetPos for PosTracker { +impl GetPos for PosTrackingReader { fn get_pos(&self) -> usize { self.position } @@ -68,7 +68,7 @@ impl Span

for Range { } } -impl Reader for PosTracker { +impl Reader for PosTrackingReader { type Error = R::Error; fn read_char(&mut self) -> Result, Self::Error> { diff --git a/tests/test_spans.rs b/tests/test_spans.rs index 2d32260..da3f09c 100644 --- a/tests/test_spans.rs +++ b/tests/test_spans.rs @@ -7,7 +7,7 @@ use codespan_reporting::{ term::{self, termcolor::Buffer}, }; use html5tokenizer::{ - spans::PosTracker, DefaultEmitter, IntoReader, StringReader, Token, Tokenizer, + spans::PosTrackingReader, DefaultEmitter, IntoReader, StringReader, Token, Tokenizer, }; #[test] @@ -19,11 +19,11 @@ fn test() { let mut labels = Vec::new(); for token in Tokenizer::new_with_emitter( - PosTracker { + PosTrackingReader { reader: html.into_reader(), position: 0, }, - DefaultEmitter::, Range>::default(), + DefaultEmitter::, Range>::default(), ) .flatten() { -- cgit v1.2.3