pub struct GaugeWidget {
pub label: String,
pub value_pct: f64,
pub warning_threshold: f64,
pub critical_threshold: f64,
pub max_value: f64,
pub suffix: String,
}Expand description
Gauge widget for showing percentages
Fields§
§label: StringWidget label
value_pct: f64Current value (0.0-100.0)
warning_threshold: f64Warning threshold
critical_threshold: f64Critical threshold
max_value: f64Maximum value (usually 100)
suffix: StringSuffix text (e.g., “%” or “°C”)
Implementations§
Source§impl GaugeWidget
impl GaugeWidget
Sourcepub fn with_value(self, value: f64) -> Self
pub fn with_value(self, value: f64) -> Self
Set value
Sourcepub fn with_thresholds(self, warning: f64, critical: f64) -> Self
pub fn with_thresholds(self, warning: f64, critical: f64) -> Self
Set thresholds
Sourcepub fn color(&self) -> GaugeColor
pub fn color(&self) -> GaugeColor
Get color based on value
Sourcepub fn render_bar(&self, width: usize) -> String
pub fn render_bar(&self, width: usize) -> String
Render as ASCII bar
Trait Implementations§
Source§impl Clone for GaugeWidget
impl Clone for GaugeWidget
Source§fn clone(&self) -> GaugeWidget
fn clone(&self) -> GaugeWidget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GaugeWidget
impl RefUnwindSafe for GaugeWidget
impl Send for GaugeWidget
impl Sync for GaugeWidget
impl Unpin for GaugeWidget
impl UnsafeUnpin for GaugeWidget
impl UnwindSafe for GaugeWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more