From a22adb602c6eaed59256c8af0ae8d718a11ad5e3 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 30 Nov 2021 17:35:23 +0100 Subject: spans: introduce GetPos trait --- src/spans.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/spans.rs b/src/spans.rs index cf65053..663bd59 100644 --- a/src/spans.rs +++ b/src/spans.rs @@ -8,6 +8,10 @@ use crate::{Doctype, Emitter, EndTag, Error, StartTag, Token}; type Span = std::ops::Range; +pub trait GetPos { + fn get_pos(&self) -> usize; +} + /// The default implementation of [`crate::Emitter`], used to produce ("emit") tokens. pub struct SpanEmitter { current_characters: String, @@ -33,7 +37,7 @@ impl Default for SpanEmitter { } } -impl SpanEmitter { +impl SpanEmitter { fn emit_token(&mut self, token: Token) { self.flush_current_characters(); self.emitted_tokens.push_front(token); @@ -77,7 +81,7 @@ impl SpanEmitter { } } -impl Emitter for SpanEmitter { +impl Emitter for SpanEmitter { type Token = Token; fn set_last_start_tag(&mut self, last_start_tag: Option<&str>) { -- cgit v1.2.3