Add AttrsList::spans_iter and use it in Buffer::append

This commit is contained in:
koe 2024-08-30 21:28:21 -05:00 committed by Jeremy Soller
parent caa214a755
commit c751217020
2 changed files with 7 additions and 2 deletions

View file

@ -306,7 +306,12 @@ impl AttrsList {
/// Get the current attribute spans
pub fn spans(&self) -> Vec<(&Range<usize>, &AttrsOwned)> {
self.spans.iter().collect()
self.spans_iter().collect()
}
/// Get an iterator over the current attribute spans
pub fn spans_iter(&self) -> impl Iterator<Item = (&Range<usize>, &AttrsOwned)> + '_ {
self.spans.iter()
}
/// Clear the current attribute spans