Skip to main content

create_summary

Function create_summary 

Source
pub fn create_summary<'a>(
    summary_items: Vec<(&'a str, &'a str, Color)>,
    sys: &'a System,
    pid: Pid,
    width: u16,
) -> Paragraph<'a>
Expand description

Builds the TUI summary bar from caller-supplied items plus live memory and CPU readouts.

Each (icon, value, color) tuple in summary_items becomes a colored, pipe-separated segment; these primary items are always rendered. A Memory: <n> MB and a CPU: <n>% segment for the current process pid are then appended only while they fit within width (the summary rect’s width): on a terminal too narrow for the full line the diagnostic segments degrade gracefully, dropped whole (CPU first, then Memory) instead of clipped mid-word. They read 0.0 if sys has no entry for pid. CPU is normalized to a 0-100% share of the machine. sys is expected to have been refreshed by the caller before this call.