From 4091822a04c9e828519cdccdee6369042d0a80fd Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 11 Aug 2023 13:46:32 +0200 Subject: [PATCH] [breaking]: Rename DefaultEmitter::switch_states (#83) --- examples/tokenize_with_state_switches.rs | 2 +- src/emitter.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/tokenize_with_state_switches.rs b/examples/tokenize_with_state_switches.rs index d558df8..e4f424c 100644 --- a/examples/tokenize_with_state_switches.rs +++ b/examples/tokenize_with_state_switches.rs @@ -19,7 +19,7 @@ use html5gum::{DefaultEmitter, IoReader, Tokenizer}; fn main() { let mut emitter = DefaultEmitter::default(); - emitter.switch_states(true); + emitter.naively_switch_states(true); let reader = IoReader::new(std::io::stdin().lock()); diff --git a/src/emitter.rs b/src/emitter.rs index da686d0..5dfba98 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -359,15 +359,15 @@ pub struct DefaultEmitter { current_attribute: Option<(HtmlString, HtmlString)>, seen_attributes: BTreeSet, emitted_tokens: VecDeque, - switch_states: bool, + naively_switch_states: bool, } impl DefaultEmitter { /// Whether to use [`naive_next_state`] to switch states automatically. /// /// The default is off. - pub fn switch_states(&mut self, yes: bool) { - self.switch_states = yes; + pub fn naively_switch_states(&mut self, yes: bool) { + self.naively_switch_states = yes; } fn emit_token(&mut self, token: Token) { @@ -468,7 +468,7 @@ impl Emitter for DefaultEmitter { _ => debug_assert!(false), } self.emit_token(token); - if self.switch_states { + if self.naively_switch_states { naive_next_state(&self.last_start_tag) } else { None