Bug 1897774 - Implement Debug for HeaderSlice manually. r=firefox-style-system-reviewers,tlouw

Otherwise it doesn't show what the slice contains, which makes restyle
logs a bit useless.

Differential Revision: https://phabricator.services.mozilla.com/D210929
This commit is contained in:
Emilio Cobos Álvarez 2024-05-21 07:53:43 +00:00
Родитель a955258af0
Коммит 0d680476b7
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -682,7 +682,7 @@ impl<T: Serialize> Serialize for Arc<T> {
///
/// cbindgen:derive-eq=false
/// cbindgen:derive-neq=false
#[derive(Debug, Eq)]
#[derive(Eq)]
#[repr(C)]
pub struct HeaderSlice<H, T> {
/// The fixed-sized data.
@ -713,6 +713,15 @@ impl<H, T> Drop for HeaderSlice<H, T> {
}
}
impl<H: fmt::Debug, T: fmt::Debug> fmt::Debug for HeaderSlice<H, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("HeaderSlice")
.field("header", &self.header)
.field("slice", &self.slice())
.finish()
}
}
impl<H, T> HeaderSlice<H, T> {
/// Returns the dynamically sized slice in this HeaderSlice.
#[inline(always)]