Skip to content

Commit 39f0bfa

Browse files
biskwikmanbluss
authored andcommitted
derived Debug for Iter and IterMut
1 parent f0f4849 commit 39f0bfa

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/iterators/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,28 @@ pub mod iter;
1414
mod lanes;
1515
mod windows;
1616

17+
#[cfg(not(feature = "std"))]
18+
use alloc::vec::Vec;
1719
use std::iter::FromIterator;
1820
use std::marker::PhantomData;
1921
use std::ptr;
20-
#[cfg(not(feature = "std"))]
21-
use alloc::vec::Vec;
2222

2323
use crate::Ix1;
2424

2525
use super::{ArrayBase, ArrayView, ArrayViewMut, Axis, Data, NdProducer, RemoveAxis};
2626
use super::{Dimension, Ix, Ixs};
2727

2828
pub use self::chunks::{ExactChunks, ExactChunksIter, ExactChunksIterMut, ExactChunksMut};
29+
pub use self::into_iter::IntoIter;
2930
pub use self::lanes::{Lanes, LanesMut};
3031
pub use self::windows::Windows;
31-
pub use self::into_iter::IntoIter;
3232

3333
use std::slice::{self, Iter as SliceIter, IterMut as SliceIterMut};
3434

3535
/// Base for iterators over all axes.
3636
///
3737
/// Iterator element type is `*mut A`.
38+
#[derive(Debug)]
3839
pub struct Baseiter<A, D> {
3940
ptr: *mut A,
4041
dim: D,
@@ -306,7 +307,7 @@ where
306307
}
307308
}
308309

309-
#[derive(Clone)]
310+
#[derive(Clone, Debug)]
310311
pub enum ElementsRepr<S, C> {
311312
Slice(S),
312313
Counted(C),
@@ -317,11 +318,19 @@ pub enum ElementsRepr<S, C> {
317318
/// Iterator element type is `&'a A`.
318319
///
319320
/// See [`.iter()`](ArrayBase::iter) for more information.
321+
#[derive(Debug)]
320322
pub struct Iter<'a, A, D> {
321323
inner: ElementsRepr<SliceIter<'a, A>, ElementsBase<'a, A, D>>,
322324
}
323325

326+
// impl<'a, A, D> fmt::Debug for Iter<'a, A, D> {
327+
// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
328+
// f.debug_struct("Iter").field("inner", &self.inner).finish()
329+
// }
330+
// }
331+
324332
/// Counted read only iterator
333+
#[derive(Debug)]
325334
pub struct ElementsBase<'a, A, D> {
326335
inner: Baseiter<A, D>,
327336
life: PhantomData<&'a A>,
@@ -332,13 +341,15 @@ pub struct ElementsBase<'a, A, D> {
332341
/// Iterator element type is `&'a mut A`.
333342
///
334343
/// See [`.iter_mut()`](ArrayBase::iter_mut) for more information.
344+
#[derive(Debug)]
335345
pub struct IterMut<'a, A, D> {
336346
inner: ElementsRepr<SliceIterMut<'a, A>, ElementsBaseMut<'a, A, D>>,
337347
}
338348

339349
/// An iterator over the elements of an array.
340350
///
341351
/// Iterator element type is `&'a mut A`.
352+
#[derive(Debug)]
342353
pub struct ElementsBaseMut<'a, A, D> {
343354
inner: Baseiter<A, D>,
344355
life: PhantomData<&'a mut A>,

0 commit comments

Comments
 (0)