summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-04-08 10:25:09 +0200
committerMartin Fischer <martin@push-f.com>2021-04-08 15:40:48 +0200
commit8bb20dcdeec57b2109b05351663ec1dba9c65f84 (patch)
tree3ddf7196d2fe66d92e4819c362e248cb96be3c0b /src/util
parentfc9d3132f390b038544e45048b4fe345a3d47793 (diff)
drop markup5ever dependency
Diffstat (limited to 'src/util')
-rw-r--r--src/util/buffer_queue.rs42
-rw-r--r--src/util/smallcharset.rs14
2 files changed, 0 insertions, 56 deletions
diff --git a/src/util/buffer_queue.rs b/src/util/buffer_queue.rs
index d572489..7f8c3cc 100644
--- a/src/util/buffer_queue.rs
+++ b/src/util/buffer_queue.rs
@@ -123,31 +123,6 @@ impl BufferQueue {
/// Pops and returns either a single character from the given set, or
/// a buffer of characters none of which are in the set.
- ///
- /// # Examples
- ///
- /// ```
- /// # #[macro_use] extern crate markup5ever;
- /// # #[macro_use] extern crate tendril;
- /// # fn main() {
- /// use markup5ever::buffer_queue::{BufferQueue, SetResult};
- ///
- /// let mut queue = BufferQueue::new();
- /// queue.push_back(format_tendril!(r#"<some_tag attr="text">SomeText</some_tag>"#));
- /// let set = small_char_set!(b'<' b'>' b' ' b'=' b'"' b'/');
- /// let tag = format_tendril!("some_tag");
- /// let attr = format_tendril!("attr");
- /// let attr_val = format_tendril!("text");
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::FromSet('<')));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::NotFromSet(tag)));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::FromSet(' ')));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::NotFromSet(attr)));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::FromSet('=')));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::FromSet('"')));
- /// assert_eq!(queue.pop_except_from(set), Some(SetResult::NotFromSet(attr_val)));
- /// // ...
- /// # }
- /// ```
pub fn pop_except_from(&mut self, set: SmallCharSet) -> Option<SetResult> {
let (result, now_empty) = match self.buffers.front_mut() {
None => (None, false),
@@ -181,23 +156,6 @@ impl BufferQueue {
/// it wasn't possible to know (more data is needed).
///
/// The custom comparison function is used elsewhere to compare ascii-case-insensitively.
- ///
- /// # Examples
- ///
- /// ```
- /// # extern crate markup5ever;
- /// # #[macro_use] extern crate tendril;
- /// # fn main() {
- /// use markup5ever::buffer_queue::{BufferQueue};
- ///
- /// let mut queue = BufferQueue::new();
- /// queue.push_back(format_tendril!("testtext"));
- /// let test_str = "test";
- /// assert_eq!(queue.eat("test", |&a, &b| a == b), Some(true));
- /// assert_eq!(queue.eat("text", |&a, &b| a == b), Some(true));
- /// assert!(queue.is_empty());
- /// # }
- /// ```
pub fn eat<F: Fn(&u8, &u8) -> bool>(&mut self, pat: &str, eq: F) -> Option<bool> {
let mut buffers_exhausted = 0;
let mut consumed_from_last = 0;
diff --git a/src/util/smallcharset.rs b/src/util/smallcharset.rs
index 957dad7..aeeb189 100644
--- a/src/util/smallcharset.rs
+++ b/src/util/smallcharset.rs
@@ -41,20 +41,6 @@ impl SmallCharSet {
/// Count the number of bytes of characters at the beginning of `buf` which are not in the set.
///
/// This functionality is used in [`BufferQueue::pop_except_from`].
- ///
- /// # Examples
- ///
- /// ```
- /// # #[macro_use] extern crate markup5ever;
- /// # fn main() {
- /// let set = small_char_set!(48 49 50); // '0' '1' '2'
- /// // `test` is 4 chars, ๐Ÿ˜ is 4 chars, then we meet a character in the set
- /// let test_str = "test๐Ÿ˜01232afd";
- /// assert_eq!(set.nonmember_prefix_len(test_str), 8);
- /// # }
- /// ```
- ///
- /// [`BufferQueue::pop_except_from`]: buffer_queue/struct.BufferQueue.html#method.pop_except_from
pub fn nonmember_prefix_len(&self, buf: &str) -> u32 {
let mut n = 0;
for b in buf.bytes() {