Meter
显示已知范围内的标量测量值,并带有语义化的低值、高值和最佳区间。
正在加载交互演示…
meter(70.0, 0.0, 100.0).w(240.0).h(8.0)#导入
从 quickgui 导入 meter。
use quickgui::*;#用法
meter(70.0, 0.0, 100.0).w(240.0).h(8.0)#结构
meter::rootmeter::trackmeter::indicatormeter::labelmeter::value
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Meter
查看源码pub fn new(value: f64, minimum: f64, maximum: f64) -> SelfCreate a meter. Non-finite bounds fall back to `0.0..=1.0` and an inverted range is swapped.
lowpub fn low(mut self, low: f64) -> Self—
Mark the upper end of the low range. Values outside the meter bounds are clamped.
pub fn low(mut self, low: f64) -> Self查看源码highpub fn high(mut self, high: f64) -> Self—
optimumpub fn optimum(mut self, optimum: f64) -> Self—
idpub fn id(mut self, id: impl Into<ElementId>) -> Self—
Give this meter a stable identity so its label and value parts can be related to it.
pub fn id(mut self, id: impl Into<ElementId>) -> Self查看源码formatpub fn format(mut self, format: ValueFormat) -> Self—
Attach a bounded value formatter, Base UI's `format` prop.
pub fn format(mut self, format: ValueFormat) -> Self查看源码value_textpub fn value_text(mut self, text: impl Into<Arc<str>>) -> Self—
Attach a human-readable value that assistive technology prefers over the raw number. This is Base UI's `getAriaValueText`; an empty string clears it. It wins over [`Self::format`].
pub fn value_text(mut self, text: impl Into<Arc<str>>) -> Self查看源码display_valuepub fn display_value(&self) -> Option<Arc<str>>—
The formatted text for a caller-owned value part.
pub fn display_value(&self) -> Option<Arc<str>>查看源码accessible_valuepub fn accessible_value(&self) -> Option<Arc<str>>—
The text assistive technology reads for the value, if any.
pub fn accessible_value(&self) -> Option<Arc<str>>查看源码label_idpub fn label_id(&self) -> Option<ElementId>—
Stable identity of the label part, when this meter declares one.
pub fn label_id(&self) -> Option<ElementId>查看源码value_idpub fn value_id(&self) -> Option<ElementId>—
Stable identity of the value part, when this meter declares one.
pub fn value_id(&self) -> Option<ElementId>查看源码track_idpub fn track_id(&self) -> Option<ElementId>—
Stable identity of the track part, when this meter declares one.
pub fn track_id(&self) -> Option<ElementId>查看源码indicator_idpub fn indicator_id(&self) -> Option<ElementId>—
Stable identity of the indicator part, when this meter declares one.
pub fn indicator_id(&self) -> Option<ElementId>查看源码current_valuepub const fn current_value(&self) -> f64—
minimumpub const fn minimum(&self) -> f64—
maximumpub const fn maximum(&self) -> f64—
low_valuepub const fn low_value(&self) -> Option<f64>—
high_valuepub const fn high_value(&self) -> Option<f64>—
optimum_valuepub const fn optimum_value(&self) -> Option<f64>—
completionpub fn completion(&self) -> f32—
is_lowpub fn is_low(&self) -> bool—
is_highpub fn is_high(&self) -> bool—
Meter::root_with
查看源码pub fn root_with(&self, root: Element) -> ElementDecorate an application-owned root without adding layout or appearance.
Meter::root
查看源码pub fn root(&self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Meter::track_with
查看源码pub fn track_with(&self, track: Element) -> ElementDecorate the caller-owned track that the fill is measured inside.
Meter::track
查看源码pub fn track(&self) -> ElementCreate the unstyled track part. Use [`Self::track_with`] to supply an existing element.
Meter::indicator_with
查看源码pub fn indicator_with(&self, indicator: Element) -> ElementHide an application-owned fill from the accessible name.
Meter::indicator
查看源码pub fn indicator(&self) -> ElementCreate the unstyled indicator part. Use [`Self::indicator_with`] to supply an existing element.
Meter::label_with
查看源码pub fn label_with(&self, label: Element) -> ElementAssign the stable mounted label target the root points at.
Meter::label
查看源码pub fn label(&self) -> ElementCreate the unstyled label part. Use [`Self::label_with`] to supply an existing element.
Meter::value
查看源码pub fn value(&self) -> ElementAssign the stable mounted value target the root points at. Create the unstyled value text part.
Meter::value_with
查看源码pub fn value_with(&self, value: Element) -> Elementmeter
查看源码pub fn meter(value: f64, minimum: f64, maximum: f64) -> ElementCreate an unstyled meter root. This shorthand is equivalent to `Meter::new(value, minimum, maximum).root_with(div())`.
