diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-15 19:31:17 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-08-19 06:41:55 +0200 |
commit | 410bff8467a29eae8a7fba26176b8e8d25b734a2 (patch) | |
tree | b9d061336de8fe714b765130d154fbbe6369171f /src/reader.rs | |
parent | 36fbad12e7a50fcae3cc5e9e2d2baccd828115a5 (diff) |
docs: remove Tokenizer::new examples from Reader docs
Diffstat (limited to 'src/reader.rs')
-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, |