Skip to content

Commit 15a9b07

Browse files
authored
Merge pull request #540 from dtolnay/debug-cxxvector
Add Debug impl for CxxVector<T>
2 parents a23d7fd + a8100ed commit 15a9b07

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/cxx_vector.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::cxx_string::CxxString;
22
use crate::extern_type::ExternType;
33
use crate::kind::Trivial;
44
use core::ffi::c_void;
5-
use core::fmt::{self, Display};
5+
use core::fmt::{self, Debug, Display};
66
use core::marker::{PhantomData, PhantomPinned};
77
use core::mem;
88
use core::ptr;
@@ -124,6 +124,15 @@ where
124124
}
125125
}
126126

127+
impl<T> Debug for CxxVector<T>
128+
where
129+
T: VectorElement + Debug,
130+
{
131+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
132+
formatter.debug_list().entries(self).finish()
133+
}
134+
}
135+
127136
pub struct TypeName<T> {
128137
element: PhantomData<T>,
129138
}

0 commit comments

Comments
 (0)