aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/reader.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/reader.rs b/src/reader.rs
index 3c39b16..7038847 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -55,6 +55,22 @@ impl<'a, R: 'a + Reader> IntoReader<'a> for R {
}
}
+impl<R: Reader + ?Sized> Reader for Box<R> {
+ type Error = R::Error;
+
+ fn read_char(&mut self) -> Result<Option<char>, Self::Error> {
+ self.as_mut().read_char()
+ }
+
+ fn try_read_string(&mut self, s: &str, case_sensitive: bool) -> Result<bool, Self::Error> {
+ self.as_mut().try_read_string(s, case_sensitive)
+ }
+
+ fn len_of_char_in_current_encoding(&self, c: char) -> usize {
+ self.as_ref().len_of_char_in_current_encoding(c)
+ }
+}
+
/// A helper struct to seek forwards and backwards in strings. Used by the tokenizer to read HTML
/// from strings.
pub struct StringReader<'a> {