aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-28 18:35:59 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:00:05 +0200
commitec8f612754a516797589d23cf08b60ae406a2e96 (patch)
tree067c064feecdb2559d5c9a7bf2ea2b4ee282d8f0 /src
parent632a14059b24a9435efe4df6c186a36947938475 (diff)
fix!: add missing `R: Position<O>` bounds
It doesn't make sense that you're able to construct a Tokenizer/NaiveParser that you're unable to iterate over.
Diffstat (limited to 'src')
-rw-r--r--src/naive_parser.rs4
-rw-r--r--src/tokenizer.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/naive_parser.rs b/src/naive_parser.rs
index e229592..ecf170a 100644
--- a/src/naive_parser.rs
+++ b/src/naive_parser.rs
@@ -19,7 +19,7 @@ pub struct NaiveParser<R: Reader, O: Offset, E: Emitter<O>> {
tokenizer: Tokenizer<R, O, E>,
}
-impl<R: Reader, O: Offset> NaiveParser<R, O, DefaultEmitter<O>> {
+impl<R: Reader + Position<O>, O: Offset> NaiveParser<R, O, DefaultEmitter<O>> {
/// Constructs a new naive parser.
// TODO: add example for NaiveParser::new
pub fn new<'a>(reader: impl IntoReader<'a, Reader = R>) -> Self {
@@ -39,7 +39,7 @@ impl<R: Reader + Position<usize>> NaiveParser<R, usize, DefaultEmitter<usize>> {
}
}
-impl<R: Reader, O: Offset, E: Emitter<O>> NaiveParser<R, O, E> {
+impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> NaiveParser<R, O, E> {
/// Constructs a new naive parser with a custom emitter.
// TODO: add example for NaiveParser::new_with_emitter
pub fn new_with_emitter<'a>(reader: impl IntoReader<'a, Reader = R>, emitter: E) -> Self {
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 7cc4712..05c1165 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -57,7 +57,7 @@ pub struct Tokenizer<R: Reader, O, E: Emitter<O>> {
pub(crate) naively_switch_state: bool,
}
-impl<R: Reader, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
+impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
/// Creates a new tokenizer from some input and an emitter.
///
/// Note that properly parsing HTML with this tokenizer requires you to