Skip to content

Commit 95aab8d

Browse files
authored
Merge pull request #94 from Jules-Bertholet/fusediterator
Add missing `FusedIterator` impls
2 parents 32659a7 + c8ab427 commit 95aab8d

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/decompose.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010
use core::fmt::{self, Write};
11-
use core::iter::Fuse;
11+
use core::iter::{Fuse, FusedIterator};
1212
use core::ops::Range;
1313
use tinyvec::TinyVec;
1414

@@ -151,6 +151,8 @@ impl<I: Iterator<Item = char>> Iterator for Decompositions<I> {
151151
}
152152
}
153153

154+
impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Decompositions<I> {}
155+
154156
impl<I: Iterator<Item = char> + Clone> fmt::Display for Decompositions<I> {
155157
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
156158
for c in self.clone() {

src/recompose.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
// except according to those terms.
1010

1111
use crate::decompose::Decompositions;
12-
use core::fmt::{self, Write};
12+
use core::{
13+
fmt::{self, Write},
14+
iter::FusedIterator,
15+
};
1316
use tinyvec::TinyVec;
1417

1518
#[derive(Clone)]
@@ -144,6 +147,8 @@ impl<I: Iterator<Item = char>> Iterator for Recompositions<I> {
144147
}
145148
}
146149

150+
impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Recompositions<I> {}
151+
147152
impl<I: Iterator<Item = char> + Clone> fmt::Display for Recompositions<I> {
148153
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
149154
for c in self.clone() {

src/replace.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
use core::fmt::{self, Write};
10+
use core::{
11+
fmt::{self, Write},
12+
iter::FusedIterator,
13+
};
1114
use tinyvec::ArrayVec;
1215

1316
/// External iterator for replacements for a string's characters.
@@ -51,6 +54,8 @@ impl<I: Iterator<Item = char>> Iterator for Replacements<I> {
5154
}
5255
}
5356

57+
impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Replacements<I> {}
58+
5459
impl<I: Iterator<Item = char> + Clone> fmt::Display for Replacements<I> {
5560
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5661
for c in self.clone() {

src/stream_safe.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::iter::FusedIterator;
2+
13
use crate::lookups::{
24
canonical_combining_class, canonical_fully_decomposed, compatibility_fully_decomposed,
35
stream_safe_trailing_nonstarters,
@@ -59,6 +61,8 @@ impl<I: Iterator<Item = char>> Iterator for StreamSafe<I> {
5961
}
6062
}
6163

64+
impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for StreamSafe<I> {}
65+
6266
#[derive(Debug)]
6367
pub(crate) struct Decomposition {
6468
pub(crate) leading_nonstarters: usize,

0 commit comments

Comments
 (0)