This is a simple iterator adapter thats is applicable to iterators where the Iterator::Item is std::fmt::Debug
It prints to stderr
by default, but using the feature 'logging' prints out to the log
crate facade.
```rust use debug_iterator::DebugIterator as _;
struct Person { name: String, age: i32 }
let everyoneisnamedbob = "Bob".tostring(); let iter = (1..=3) .map(|k| k * 4) .map(|age| Person { name: everyoneisnamed_bob.clone(), age, }) .clone();
// debug ("{:?}") iter.debug().foreach(|| ()); // Person { name: "Bob", age: 4 } // Person { name: "Bob", age: 8 } // Person { name: "Bob", age: 12 }
// debugpretty ("{:#?}") iter.debugpretty().foreach(|| ()); // Person { // name: "Bob", // age: 4, // } // Person { // name: "Bob", // age: 8, // } // Person { // name: "Bob", // age: 12, // }
// '{:?}' with a &str
prefix:
iter.debugprefix("This person is").foreach(|_| ());
// This person is: Person { name: "Bob", age: 4 }
// This person is: Person { name: "Bob", age: 8 }
// This person is: Person { name: "Bob", age: 12 }
// '{:#?}' with a &str
prefix:
iter.debugprefixpretty("This person is").foreach(|| ());
// This person is: Person {
// name: "Bob",
// age: 4,
// }
// This person is: Person {
// name: "Bob",
// age: 8,
// }
// This person is: Person {
// name: "Bob",
// age: 12,
// }
```
License: 0BSD