cds/arrayvec/traits/
debug.rs1use crate::{arrayvec::ArrayVec, len::LengthType, mem::SpareMemoryPolicy};
2use core::fmt::{Debug, Formatter, Result};
3
4impl<T, L, SM, const C: usize> Debug for ArrayVec<T, C, L, SM>
5where
6 T: Debug,
7 L: LengthType,
8 SM: SpareMemoryPolicy<T>,
9{
10 #[inline]
11 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
12 Debug::fmt(&**self, f)
13 }
14}
15
16#[cfg(feature = "std")]
17#[cfg(test)]
18mod testing {
19 use crate as cds;
20 use crate::array_vec;
21
22 #[test]
23 fn test_debug() {
24 let mut a = array_vec![3; String];
25 a.push("Hello".into());
26 a.push(", ".into());
27 a.push("world!".into());
28 let s = format!("{:?}", a);
29 assert_eq!(s, "[\"Hello\", \", \", \"world!\"]");
30 }
31}