feat: implement Debug for Deque

This commit is contained in:
Hiroki Tokunaga 2021-09-05 15:44:30 +09:00
parent 59bc89f297
commit 9c0c565178
No known key found for this signature in database
GPG Key ID: E276791E129FF601

View File

@ -1,3 +1,4 @@
use core::fmt;
use core::iter::FusedIterator; use core::iter::FusedIterator;
use core::marker::PhantomData; use core::marker::PhantomData;
use core::mem::MaybeUninit; use core::mem::MaybeUninit;
@ -374,6 +375,12 @@ impl<T, const N: usize> Drop for Deque<T, N> {
} }
} }
impl<T: fmt::Debug, const N: usize> fmt::Debug for Deque<T, N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self).finish()
}
}
/// An iterator that moves out of a [`Deque`]. /// An iterator that moves out of a [`Deque`].
/// ///
/// This struct is created by calling the `into_iter` method. /// This struct is created by calling the `into_iter` method.