pub struct Gauge<'a> { /* private fields */ }Expand description
Block-fill gauge builder. Auto-renders on Drop.
Constructed via Context::gauge. Chainable .label, .width, .color
methods configure the gauge before it renders. Drop the value to render
without capturing a response, or call Self::show to render and obtain
a GaugeResponse.
Drop is intentional: ui.gauge(0.5).label("CPU"); is the idiomatic form
when the response isn’t needed, mirroring egui’s ui.add(...). Use
Self::show when you need the response.
§Family
Use LineGauge for a compact single-line bar with a trailing label, or
Context::progress_bar / Context::progress for an unlabeled bar.
Implementations§
Source§impl<'a> Gauge<'a>
impl<'a> Gauge<'a>
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Set the centered inline label. Empty string is treated as “no label”.
Accepts both &str and owned String via impl Into<String> so
callers with already-owned strings (e.g. format!(...)) don’t pay a
redundant clone.
Sourcepub fn show(self) -> GaugeResponse
pub fn show(self) -> GaugeResponse
Render now and return the GaugeResponse.