diff options
-rw-r--r-- | src/reader.rs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/reader.rs b/src/reader.rs index 6067c47..0e7a3a4 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -49,33 +49,6 @@ impl<'a, R: 'a + Reader> IntoReader<'a> for R { /// A helper struct to seek forwards and backwards in strings. Used by the tokenizer to read HTML /// from strings. -/// -/// Example: -/// -/// ```rust -/// use std::fmt::Write; -/// use html5tokenizer::{Tokenizer, Token}; -/// -/// let html = "<title >hello world</title>"; -/// let mut new_html = String::new(); -/// -/// for token in Tokenizer::new(html).infallible() { -/// match token { -/// Token::StartTag(tag) => { -/// write!(new_html, "<{}>", tag.name).unwrap(); -/// } -/// Token::String(hello_world) => { -/// write!(new_html, "{}", hello_world).unwrap(); -/// } -/// Token::EndTag(tag) => { -/// write!(new_html, "</{}>", tag.name).unwrap(); -/// } -/// _ => panic!("unexpected input"), -/// } -/// } -/// -/// assert_eq!(new_html, "<title>hello world</title>"); -/// ``` pub struct StringReader<'a> { input: &'a str, cursor: std::str::Chars<'a>, @@ -138,40 +111,6 @@ impl<'a> IntoReader<'a> for &'a String { /// A [`BufReadReader`] can be used to construct a tokenizer from any type that implements /// `BufRead`. -/// -/// Example: -/// -/// ```rust -/// use std::io::BufReader; -/// use std::fmt::Write; -/// use html5tokenizer::{Token, BufReadReader, Tokenizer}; -/// -/// let tokenizer = Tokenizer::new(BufReader::new("<title>hello world</title>".as_bytes())); -/// // or alternatively: -/// // tokenizer = Tokenizer::new(BufReadReader::new(BufReader::new("...".as_bytes()))); -/// -/// let mut new_html = String::new(); -/// -/// for token in tokenizer { -/// let token = token.unwrap(); -/// -/// match token { -/// Token::StartTag(tag) => { -/// write!(new_html, "<{}>", tag.name).unwrap(); -/// } -/// Token::String(hello_world) => { -/// write!(new_html, "{}", hello_world).unwrap(); -/// } -/// Token::EndTag(tag) => { -/// write!(new_html, "</{}>", tag.name).unwrap(); -/// } -/// _ => panic!("unexpected input"), -/// } -/// -/// } -/// -/// assert_eq!(new_html, "<title>hello world</title>"); -/// ``` pub struct BufReadReader<R: BufRead> { line: String, line_pos: usize, |