Skip to content

Commit

Permalink
Mark both Select iterators as fused to enable downstream optimizations.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold committed Oct 29, 2023
1 parent 05976d0 commit ee9049a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/element_ref/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Element references.
use std::iter::FusedIterator;
use std::ops::Deref;

use ego_tree::iter::{Edge, Traverse};
Expand Down Expand Up @@ -115,6 +116,8 @@ impl<'a, 'b> Iterator for Select<'a, 'b> {
}
}

impl FusedIterator for Select<'_, '_> {}

/// Iterator over descendent text nodes.
#[derive(Debug, Clone)]
pub struct Text<'a> {
Expand Down
3 changes: 3 additions & 0 deletions src/html/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#[cfg(feature = "errors")]
use std::borrow::Cow;
use std::iter::FusedIterator;

use ego_tree::iter::Nodes;
use ego_tree::Tree;
Expand Down Expand Up @@ -161,6 +162,8 @@ impl<'a, 'b> DoubleEndedIterator for Select<'a, 'b> {
}
}

impl FusedIterator for Select<'_, '_> {}

mod serializable;
mod tree_sink;

Expand Down

0 comments on commit ee9049a

Please sign in to comment.