Add missing Debug derive to vec::IntoIter

This commit is contained in:
Zeeshan Ali Khan 2025-06-10 21:53:06 +02:00
parent 779e608eb6
commit a290cec514
No known key found for this signature in database
GPG Key ID: F7AAB547AF6E4357
2 changed files with 26 additions and 0 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Removed generic from `history_buf::OldestOrdered`.
- Made `LenType` opt-in.
- Minor fixes to `pool::boxed` docs.
- Add missing `Debug` derive to `vec::IntoIter`.
### Fixed

View File

@ -1495,6 +1495,31 @@ where
}
}
impl<T, LenT: LenType, const N: usize> core::fmt::Debug for IntoIter<T, N, LenT>
where
T: core::fmt::Debug,
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let s = if self.next < self.vec.len {
unsafe {
slice::from_raw_parts(
self.vec
.buffer
.buffer
.as_ptr()
.cast::<T>()
.add(self.next.into_usize()),
(self.vec.len - self.next).into_usize(),
)
}
} else {
&[]
};
write!(f, "{s:?}")
}
}
impl<T, LenT: LenType, const N: usize> Drop for IntoIter<T, N, LenT> {
fn drop(&mut self) {
unsafe {