ndarray
ndarray copied to clipboard
derived Debug for Iter and IterMut
My attempt to implement Debug for Iter, I also did so for IterMut. #1204
Example:
input:
fn main() {
let foo = ndarray::Array1::<f64>::zeros(10);
println!("{:?}", std::iter::zip(0..foo.len(), &foo));
}
output:
Zip { a: 0..10, b: Iter { inner: Slice(Iter([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])) } }
Update the description with one output example. Also, you left several lines of commented code.
I see 2 problems:
- Please also add the output of a 2D arrays so we know how it will be printed
-
Iter { inner: Slice(Iter([...])) } }is uselessly descriptive. The user doesn't want to know the technical architecture of ndarray, he simply wants to print the values in the iterator. I think you will be forced to code the function instead of using#[derive(Debug)]in order to control what you print.
Rebased. It can be prettier and more logical but it's just a Debug fmt, so it can change later. Thanks, this is a good start for this.