Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing FusedIterator impls #94

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/decompose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::fmt::{self, Write};
use core::iter::Fuse;
use core::iter::{Fuse, FusedIterator};
use core::ops::Range;
use tinyvec::TinyVec;

Expand Down Expand Up @@ -151,6 +151,8 @@ impl<I: Iterator<Item = char>> Iterator for Decompositions<I> {
}
}

impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Decompositions<I> {}

impl<I: Iterator<Item = char> + Clone> fmt::Display for Decompositions<I> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.clone() {
Expand Down
7 changes: 6 additions & 1 deletion src/recompose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
// except according to those terms.

use crate::decompose::Decompositions;
use core::fmt::{self, Write};
use core::{
fmt::{self, Write},
iter::FusedIterator,
};
use tinyvec::TinyVec;

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

impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Recompositions<I> {}

impl<I: Iterator<Item = char> + Clone> fmt::Display for Recompositions<I> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.clone() {
Expand Down
7 changes: 6 additions & 1 deletion src/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::fmt::{self, Write};
use core::{
fmt::{self, Write},
iter::FusedIterator,
};
use tinyvec::ArrayVec;

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

impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for Replacements<I> {}

impl<I: Iterator<Item = char> + Clone> fmt::Display for Replacements<I> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.clone() {
Expand Down
4 changes: 4 additions & 0 deletions src/stream_safe.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::iter::FusedIterator;

use crate::lookups::{
canonical_combining_class, canonical_fully_decomposed, compatibility_fully_decomposed,
stream_safe_trailing_nonstarters,
Expand Down Expand Up @@ -59,6 +61,8 @@ impl<I: Iterator<Item = char>> Iterator for StreamSafe<I> {
}
}

impl<I: Iterator<Item = char> + FusedIterator> FusedIterator for StreamSafe<I> {}

#[derive(Debug)]
pub(crate) struct Decomposition {
pub(crate) leading_nonstarters: usize,
Expand Down
Loading