Skip to content

Commit 05c21c4

Browse files
authored
Merge pull request #237 from toku-sa-n/impl_debug_for_deque
feat: implement `Debug` for `Deque`
2 parents 59bc89f + 9c0c565 commit 05c21c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/deque.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use core::fmt;
12
use core::iter::FusedIterator;
23
use core::marker::PhantomData;
34
use core::mem::MaybeUninit;
@@ -374,6 +375,12 @@ impl<T, const N: usize> Drop for Deque<T, N> {
374375
}
375376
}
376377

378+
impl<T: fmt::Debug, const N: usize> fmt::Debug for Deque<T, N> {
379+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
380+
f.debug_list().entries(self).finish()
381+
}
382+
}
383+
377384
/// An iterator that moves out of a [`Deque`].
378385
///
379386
/// This struct is created by calling the `into_iter` method.

0 commit comments

Comments
 (0)