aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 377dd01..efaa870 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -33,12 +33,12 @@ impl<T: Copy> Stack2<T> {
}
/// A HTML tokenizer. See crate-level docs for basic usage.
-pub struct Tokenizer<R: Reader, E: Emitter = DefaultEmitter<()>> {
+pub struct Tokenizer<R: Reader, E: Emitter<R> = DefaultEmitter<R, ()>> {
eof: bool,
pub(crate) state: InternalState,
pub(crate) emitter: E,
pub(crate) temporary_buffer: String,
- reader: R,
+ pub(crate) reader: R,
to_reconsume: Stack2<Option<char>>,
pub(crate) character_reference_code: u32,
pub(crate) return_state: Option<InternalState>,
@@ -91,7 +91,7 @@ impl From<State> for InternalState {
}
}
-impl<R: Reader, E: Emitter> Tokenizer<R, E> {
+impl<R: Reader, E: Emitter<R>> Tokenizer<R, E> {
/// Construct a new tokenizer from some input and a custom emitter.
///
/// Use this method over [`Tokenizer::new`] when you want to have more control over string allocation for
@@ -239,7 +239,7 @@ impl<R: Reader, E: Emitter> Tokenizer<R, E> {
}
}
-impl<R: Reader, E: Emitter> Iterator for Tokenizer<R, E> {
+impl<R: Reader, E: Emitter<R>> Iterator for Tokenizer<R, E> {
type Item = Result<E::Token, R::Error>;
fn next(&mut self) -> Option<Self::Item> {
@@ -266,9 +266,9 @@ impl<R: Reader, E: Emitter> Iterator for Tokenizer<R, E> {
/// `Result<Token, _>`.
///
/// This is the return value of [`Tokenizer::infallible`].
-pub struct InfallibleTokenizer<R: Reader<Error = Never>, E: Emitter>(Tokenizer<R, E>);
+pub struct InfallibleTokenizer<R: Reader<Error = Never>, E: Emitter<R>>(Tokenizer<R, E>);
-impl<R: Reader<Error = Never>, E: Emitter> Tokenizer<R, E> {
+impl<R: Reader<Error = Never>, E: Emitter<R>> Tokenizer<R, E> {
/// Statically assert that this iterator is infallible.
///
/// Call this to get rid of error handling when parsing HTML from strings.
@@ -277,7 +277,7 @@ impl<R: Reader<Error = Never>, E: Emitter> Tokenizer<R, E> {
}
}
-impl<R: Reader<Error = Never>, E: Emitter> Iterator for InfallibleTokenizer<R, E> {
+impl<R: Reader<Error = Never>, E: Emitter<R>> Iterator for InfallibleTokenizer<R, E> {
type Item = E::Token;
fn next(&mut self) -> Option<Self::Item> {
@@ -288,7 +288,7 @@ impl<R: Reader<Error = Never>, E: Emitter> Iterator for InfallibleTokenizer<R, E
}
}
-impl<R: Reader<Error = Never>, E: Emitter> Deref for InfallibleTokenizer<R, E> {
+impl<R: Reader<Error = Never>, E: Emitter<R>> Deref for InfallibleTokenizer<R, E> {
type Target = Tokenizer<R, E>;
fn deref(&self) -> &Self::Target {
@@ -296,7 +296,7 @@ impl<R: Reader<Error = Never>, E: Emitter> Deref for InfallibleTokenizer<R, E> {
}
}
-impl<R: Reader<Error = Never>, E: Emitter> DerefMut for InfallibleTokenizer<R, E> {
+impl<R: Reader<Error = Never>, E: Emitter<R>> DerefMut for InfallibleTokenizer<R, E> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}