rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
https://docs.rs/ndarray/
Apache License 2.0
3.43k stars 295 forks source link

derived Debug for Iter and IterMut #1353

Closed biskwikman closed 4 months ago

biskwikman commented 5 months ago

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])) } }
nilgoyette commented 5 months ago

Update the description with one output example. Also, you left several lines of commented code.

nilgoyette commented 5 months ago

I see 2 problems:

bluss commented 4 months ago

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.