Skip to content

Commit b055dc9

Browse files
committed
impl Debug (2) some debug_fmt_fields
1 parent 0416108 commit b055dc9

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

src/adaptors/coalesce.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ pub type DedupBy<I, Pred> = CoalesceBy<I, DedupPred2CoalescePred<Pred>, <I as It
119119
#[derive(Clone)]
120120
pub struct DedupPred2CoalescePred<DP>(DP);
121121

122+
impl<DP> fmt::Debug for DedupPred2CoalescePred<DP> {
123+
debug_fmt_fields!(DedupPred2CoalescePred,);
124+
}
125+
122126
pub trait DedupPredicate<T> {
123127
// TODO replace by Fn(&T, &T)->bool once Rust supports it
124128
fn dedup_pair(&mut self, a: &T, b: &T) -> bool;

src/adaptors/map.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ where
8484
#[derive(Clone)]
8585
pub struct MapSpecialCaseFnOk<F>(F);
8686

87+
impl<F> std::fmt::Debug for MapSpecialCaseFnOk<F> {
88+
debug_fmt_fields!(MapSpecialCaseFnOk,);
89+
}
90+
8791
/// Create a new `MapOk` iterator.
8892
pub fn map_ok<I, F, T, U, E>(iter: I, f: F) -> MapOk<I, F>
8993
where

src/adaptors/mod.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,13 @@ pub struct FilterOk<I, F> {
849849
f: F
850850
}
851851

852+
impl<I, F> fmt::Debug for FilterOk<I, F>
853+
where
854+
I: fmt::Debug,
855+
{
856+
debug_fmt_fields!(FilterOk, iter);
857+
}
858+
852859
/// Create a new `FilterOk` iterator.
853860
pub fn filter_ok<I, F, T, E>(iter: I, f: F) -> FilterOk<I, F>
854861
where I: Iterator<Item = Result<T, E>>,
@@ -917,6 +924,13 @@ pub struct FilterMapOk<I, F> {
917924
f: F
918925
}
919926

927+
impl<I, F> fmt::Debug for FilterMapOk<I, F>
928+
where
929+
I: fmt::Debug,
930+
{
931+
debug_fmt_fields!(FilterMapOk, iter);
932+
}
933+
920934
fn transpose_result<T, E>(result: Result<Option<T>, E>) -> Option<Result<T, E>> {
921935
match result {
922936
Ok(Some(v)) => Some(Ok(v)),
@@ -995,6 +1009,13 @@ pub struct Positions<I, F> {
9951009
count: usize,
9961010
}
9971011

1012+
impl<I, F> fmt::Debug for Positions<I, F>
1013+
where
1014+
I: fmt::Debug,
1015+
{
1016+
debug_fmt_fields!(Positions, iter, count);
1017+
}
1018+
9981019
/// Create a new `Positions` iterator.
9991020
pub fn positions<I, F>(iter: I, f: F) -> Positions<I, F>
10001021
where I: Iterator,
@@ -1058,6 +1079,13 @@ pub struct Update<I, F> {
10581079
f: F,
10591080
}
10601081

1082+
impl<I, F> fmt::Debug for Update<I, F>
1083+
where
1084+
I: fmt::Debug,
1085+
{
1086+
debug_fmt_fields!(Update, iter);
1087+
}
1088+
10611089
/// Create a new `Update` iterator.
10621090
pub fn update<I, F>(iter: I, f: F) -> Update<I, F>
10631091
where

src/duplicates_impl.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ mod private {
134134

135135
/// Apply a user-supplied function to elements before checking them for equality.
136136
pub struct ByFn<F>(pub(crate) F);
137+
impl<F> fmt::Debug for ByFn<F> {
138+
debug_fmt_fields!(ByFn,);
139+
}
137140
impl<K, V, F> KeyMethod<K, V> for ByFn<F>
138141
where
139142
F: FnMut(&V) -> K,

src/pad_tail.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ pub struct PadUsing<I, F> {
1616
filler: F,
1717
}
1818

19+
impl<I, F> std::fmt::Debug for PadUsing<I, F>
20+
where
21+
I: std::fmt::Debug,
22+
{
23+
debug_fmt_fields!(PadUsing, iter, min, pos);
24+
}
25+
1926
/// Create a new **PadUsing** iterator.
2027
pub fn pad_using<I, F>(iter: I, min: usize, filler: F) -> PadUsing<I, F>
2128
where I: Iterator,

src/peeking_take_while.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ pub struct PeekingTakeWhile<'a, I: 'a, F>
8383
f: F,
8484
}
8585

86+
impl<'a, I: 'a, F> std::fmt::Debug for PeekingTakeWhile<'a, I, F>
87+
where
88+
I: Iterator + std::fmt::Debug,
89+
{
90+
debug_fmt_fields!(PeekingTakeWhile, iter);
91+
}
92+
8693
/// Create a PeekingTakeWhile
8794
pub fn peeking_take_while<I, F>(iter: &mut I, f: F) -> PeekingTakeWhile<I, F>
8895
where I: Iterator,

0 commit comments

Comments
 (0)