pub struct DebugSection { /* private fields */ }Expand description
One system’s contribution to the panel: a title, its rows, and any graphs under them.
Rows and graphs are kept in Vecs that are reused rather than
reallocated: DebugSection::clear resets the lengths without dropping
the strings, so a module that writes the same rows every frame allocates
on the first frame only.
Implementations§
Source§impl DebugSection
impl DebugSection
Sourcepub fn row(&mut self, label: &str, value: Arguments<'_>)
pub fn row(&mut self, label: &str, value: Arguments<'_>)
Appends a row, formatting value into a string this section already
owns.
Takes fmt::Arguments rather than a String so the caller writes
section.row("fps", format_args!("{fps:.1}")) and nothing allocates
after the first frame.
Sourcepub fn row_str(&mut self, label: &str, value: &str)
pub fn row_str(&mut self, label: &str, value: &str)
Appends a row whose value is already a string.
Sourcepub fn graph(
&mut self,
label: &str,
samples: impl IntoIterator<Item = f32>,
scale: f32,
)
pub fn graph( &mut self, label: &str, samples: impl IntoIterator<Item = f32>, scale: f32, )
Appends a graph of samples, oldest first, drawn under the rows as a
bar each, full height at scale and above. A scale that is not
above zero draws every bar empty rather than dividing by it.
The graph says nothing of its scale; a module that wants it read writes it in a row.
Sourcepub fn graphs(&self) -> &[DebugGraph]
pub fn graphs(&self) -> &[DebugGraph]
The live graphs.