Struct Metrics
pub struct Metrics {Show 34 fields
pub bar_height: f32,
pub bar_control_height: f32,
pub panel_row_height: f32,
pub menu_row_height: f32,
pub menu_min_width: f32,
pub scrollbar_gutter: f32,
pub selector_height: f32,
pub min_pointer_target: f32,
pub panel_width_utility: f32,
pub panel_width_list: f32,
pub panel_width_sheet: f32,
pub icon_sm: f32,
pub icon_md: f32,
pub icon_lg: f32,
pub icon_label_gap: f32,
pub chrome_rule_px: f32,
pub sidebar_width: f32,
pub drawer_width: f32,
pub overview_width: f32,
pub compact_breakpoint: f32,
pub nav_row_height: f32,
pub header_height: f32,
pub rail_width: f32,
pub inspector_width: f32,
pub sidebar_min_width: f32,
pub sidebar_max_width: f32,
pub content_min_width: f32,
pub detail_min_width: f32,
pub readable_width: f32,
pub reading_measure: f32,
pub chooser_width: f32,
pub wheel_line: f32,
pub scroll_thumb: f32,
pub swipe_commit: f32,
}Expand description
Reference density (HIG §9.6), unscaled. Read live values from
theme.tokens.metrics.
Fields§
§bar_height: f32A top bar, toolbar or status strip. Also the default height of the
shared Button and Dropdown controls.
bar_control_height: f32A control living inside a 40 px bar (segmented switch, bar button).
panel_row_height: f32One row of a Panel — a settings toggle row, a roster entry.
One row of a menu (context menu, dropdown list).
The narrowest a menu stands, however short its labels: a menu of one short item still reads as a menu, not as a button.
scrollbar_gutter: f32Room a scroll view keeps on its trailing edge for its scroll bar
while its content overflows, so the bar never covers content: the
thumb (Metrics::scroll_thumb) plus s1 on each side.
selector_height: f32A compact selector (chip, tab pill, dropdown trigger in a Panel).
min_pointer_target: f32No pointer target is smaller than this, whatever glyph it shows.
panel_width_utility: f32A utility Panel such as quick settings.
panel_width_list: f32A roster or list Panel.
panel_width_sheet: f32A sheet carrying a form.
icon_sm: f32Compact glyph: tab leading icon, inline status mark.
icon_md: f32The standard 20 px glyph that sits in a 32 px hit rect.
icon_lg: f32Large glyph: empty-state mark, list leading icon.
icon_label_gap: f32Between an icon and the label it belongs to (Button, Tabs).
chrome_rule_px: f32Thickness of the rule under a toolbar and along a status bar.
1 is the hairline. 0 draws no rule. A heavier value is a
stronger chrome edge. ui_scale multiplies it; a theme’s spacing
preference does not.
A genuine navigation sidebar (HIG §1a) when docked.
drawer_width: f32An overlay drawer; equal to Metrics::panel_width_utility so a
docked utility panel and a slid-in drawer are one width.
overview_width: f32The overview column of an overview + detail pair (HIG §1b).
compact_breakpoint: f32At or above this window width a sidebar docks beside its content;
below it the shell switches to separate screens or an overlay.
sidebar_width plus a content column that still reads
(Metrics::content_min_width).
One row of a navigation list (NavList, paint_nav_row) at the
default text scale; it grows with the body line like any shell
control that carries one line of text.
header_height: f32The one header row a NavShell draws across the top of the window:
a min_pointer_target control in an s3 inset (32 + 2 × 12).
rail_width: f32A compact icon-over-label navigation rail (NavList::rail).
inspector_width: f32The inspector column at the trailing edge of a window.
Narrowest a person can drag a docked sidebar; dragging it below this hides it.
Widest a person can drag a docked sidebar.
content_min_width: f32The room the content beside a sidebar needs: a readable column, the
width of a sheet (Metrics::panel_width_sheet). Narrower than this
the content would be squeezed, so the sidebar collapses into a
drawer instead (compact_breakpoint − sidebar_width).
detail_min_width: f32Narrowest the detail column beside an overview may become before the two become push screens.
readable_width: f32The widest a form, a settings page or a page of facts grows
(FormPage, Page, PropertyList, Container::readable). Wider
windows leave the extra room beside it.
reading_measure: f32The line length of long-form reading text (documents, books, notes):
about 66 characters of the Reading role at the stock text size.
chooser_width: f32The width a compact chooser (dropdown, segmented switch, single-line entry) keeps beside its label in a form row.
wheel_line: f32How far one notch of a line-stepping wheel scrolls.
scroll_thumb: f32Thickness of a scroll bar’s thumb at rest; the bar’s gutter is the
thumb plus s1 on each side.
swipe_commit: f32How far a row must be swiped sideways before letting go commits its swipe action rather than springing back.
Implementations§
§impl Metrics
impl Metrics
pub fn text_growth(text_scale: f32) -> f32
pub fn text_growth(text_scale: f32) -> f32
The factor a text-sized width or breakpoint grows by at a given
accessibility text scale: text_scale.max(1.0).
A destination list, an overview column and the window width at which
two panes still fit side by side are all sized by the text they hold,
so they grow with the text — but never shrink below their authored
1× geometry, where the rows, hit targets and paddings were designed.
This is the one rule the responsive shells (NavShell,
SidebarDrawer) apply to their inputs
(crate::Theme::responsive_scale), so an app never restates it.
A non-finite scale counts as 1×.
pub fn icon_growth(text_scale: f32) -> f32
pub fn icon_growth(text_scale: f32) -> f32
The factor the glyph metrics (icon_sm, icon_md, icon_lg) grow
by at a given accessibility text scale: the square root of
Self::text_growth. A glyph sits beside the text it labels, so it
grows with it, as symbols follow Dynamic Type; it grows less than the
letters, since a glyph already reads at a smaller size than a word and
still has to fit the control the text has grown. 2x text gives
glyphs about 1.41x. Never below 1.
pub fn with_icons_scaled(self, factor: f32) -> Metrics
pub fn with_icons_scaled(self, factor: f32) -> Metrics
These metrics with the glyph sizes multiplied by factor; see
Self::icon_growth.
Trait Implementations§
impl Copy for Metrics
impl StructuralPartialEq for Metrics
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnsafeUnpin for Metrics
impl UnwindSafe for Metrics
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more