Skip to main content

Metrics

Struct Metrics 

pub struct Metrics {
Show 77 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 call_edge_px: f32, pub alert_edge_px: f32, pub sidebar_width: f32, pub drawer_width: f32, pub overview_width: f32, pub overview_max_width: f32, pub compact_breakpoint: f32, pub nav_row_height: f32, pub header_height: f32, pub rail_width: f32, pub rail_max_width: f32, pub inspector_width: f32, pub sidebar_min_width: f32, pub panel_min_width: f32, pub sidebar_max_width: f32, pub content_min_width: f32, pub detail_min_width: f32, pub window_min_width: f32, pub list_min_width: f32, pub reading_min_width: f32, pub page_min_width: f32, pub grid_min_width: f32, pub board_lane_width: f32, pub layout_hysteresis: f32, pub readable_width: f32, pub reading_measure: f32, pub message_measure: f32, pub chooser_width: f32, pub field_min_width: f32, pub wheel_line: f32, pub scroll_thumb: f32, pub swipe_commit: f32, pub row_single: f32, pub row_double: f32, pub row_avatar: f32, pub icon_control: f32, pub icon_bar: f32, pub avatar_inline: f32, pub avatar_row: f32, pub location_min_width: f32, pub location_comfortable_width: f32, pub note_wrap_width: f32, pub sheet_max_height: f32, pub listing_row_height: f32, pub face_stack: f32, pub face_stack_step: f32, pub overview_panel_width: f32, pub overview_picture_min_width: f32, pub row_action_width: f32, pub row_arrow: f32, pub row_slider_width: f32, pub row_slider_min_width: f32, pub row_slider_valued_width: f32, pub meter_height: f32, pub chart_height: f32, pub aside_min_width: f32, pub figure_size: f32, pub picture_tile_min_width: f32, pub picture_tile_width: f32, pub click_slop: f32, pub drag_line_px: f32,
}
Expand description

Reference density (HIG §9.6), unscaled. Read live values from theme.tokens.metrics.

Fields§

§bar_height: f32

A top bar, toolbar or status strip. Also the default height of the shared Button and Dropdown controls.

§bar_control_height: f32

A control living inside a 40 px bar (segmented switch, bar button).

§panel_row_height: f32

One row of a Panel — a settings toggle row, a roster entry.

§menu_row_height: f32

One row of a menu (context menu, dropdown list).

§menu_min_width: f32

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: f32

Room 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: f32

A compact selector (chip, tab pill, dropdown trigger in a Panel).

§min_pointer_target: f32

No pointer target is smaller than this, whatever glyph it shows.

§panel_width_utility: f32

A utility Panel such as quick settings.

§panel_width_list: f32§panel_width_sheet: f32

A sheet carrying a form.

§icon_sm: f32

Compact glyph: tab leading icon, inline status mark.

§icon_md: f32

The standard 20 px glyph that sits in a 32 px hit rect.

§icon_lg: f32

Large glyph: empty-state mark, list leading icon.

§icon_label_gap: f32

Between an icon and the label it belongs to (Button, Tabs).

§chrome_rule_px: f32

Thickness 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.

§call_edge_px: f32

The edge a display wears while a call rings on another one.

§alert_edge_px: f32

The edge every display wears for a visual alert: obvious without a full-screen flash.

§sidebar_width: f32

A genuine navigation sidebar (HIG §1a) when docked.

§drawer_width: f32

An overlay drawer; equal to Metrics::panel_width_utility so a docked utility panel and a slid-in drawer are one width.

§overview_width: f32

The overview column of an overview + detail pair (HIG §1b).

§overview_max_width: f32

The widest the overview column grows to fit what it lists: a row’s title beside its facts, whole. Past it the title elides, and the detail keeps the room.

§compact_breakpoint: f32

A generic “wide window” width for painted apps that pick a compact chrome by width: sidebar_width plus Metrics::content_min_width. NavShell and SidebarDrawer dock by the content’s real minimum instead.

§nav_row_height: f32

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: f32

The 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: f32

A compact icon-over-label navigation rail (NavList::rail).

§rail_max_width: f32

The widest a rail grows as the text grows, to fit its longest single word (crate::chrome::rail_width_fitting); past it a word elides.

§inspector_width: f32

The inspector column at the trailing edge of a window.

§sidebar_min_width: f32

Narrowest a person can drag a docked sidebar; dragging it below this hides it. The same width a docked panel keeps beside a content column before it floats over it (Self::panel_min_width).

§panel_min_width: f32

The narrowest a sidebar or panel works at beside a painted app’s own content column, as a split of the app’s window: a name beside its value, a destination’s label whole. Beside a content kind’s minimum a shell panel shrinks toward this first (SidebarDrawer::content_kind) and stops docking there.

§sidebar_max_width: f32

Widest a person can drag a docked sidebar.

§content_min_width: f32

A generous content column: the width of a sheet (Metrics::panel_width_sheet). Painted apps that split their own window use it; NavShell docks by the content’s real minimum instead (the *_min_width metrics of its ContentKind).

§detail_min_width: f32

Narrowest a detail column beside a list may become in a painted app’s own split. NavShell uses its content kind’s minimum.

§window_min_width: f32

Narrowest a Tilo app’s window becomes: its compact layout, one screen at a time, at phone width. Resizing a window stops its edge here (widget::edge_resize), so every app’s compact layout must fit it.

§list_min_width: f32

The narrowest a list or table of items (files, messages, tracks) still works at: name, a line of detail, a trailing value.

§reading_min_width: f32

The narrowest a reading column (a message, an article) still works at: about 45 characters of body text.

§page_min_width: f32

The narrowest a page of settings, a form or a page of facts still works at: a label above its control.

§grid_min_width: f32

The narrowest a grid of media tiles still works at: two tiles.

§board_lane_width: f32

A board lane’s reading width: a card and its facts on one comfortable measure, the same on every board at every window width. Lanes stand left-aligned, as wide as this; the room a wider pane leaves stands open beside them instead of stretching every card across it.

§layout_hysteresis: f32

How much wider than its threshold a window must grow before a layout that switched away switches back, so a window resized near a threshold does not flicker between two layouts.

§readable_width: f32

The 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: f32

The line length of long-form reading text (documents, books, notes): about 66 characters of the Reading role at the stock text size.

§message_measure: f32

The longest line a short message runs to (an empty state’s title and message), so a wide window wraps it under its title instead of stretching one sentence across the whole width.

§chooser_width: f32

The width a compact chooser (dropdown, segmented switch, single-line entry) keeps beside its label in a form row.

§field_min_width: f32

The narrowest a text field stands where nothing else sets its width: a row that wraps or a run that hugs its items lays a field out at its own width, which is this, grown with the text. Never zero, so a field always has room for a few words of what is typed.

§wheel_line: f32

How far one notch of a line-stepping wheel scrolls.

§scroll_thumb: f32

Thickness of a scroll bar’s thumb at rest; the bar’s gutter is the thumb plus s1 on each side.

§swipe_commit: f32

How far a row must be swiped sideways before letting go commits its swipe action rather than springing back.

§row_single: f32

A one-line list row (super::Density::rows).

§row_double: f32

A list row with a title and a secondary line.

§row_avatar: f32

A list row led by a 40 px avatar or icon.

§icon_control: f32

A glyph in a row or a control: Lucide at 16.

§icon_bar: f32

The leading app or location icon of a bar.

§avatar_inline: f32§avatar_row: f32

An avatar leading a two-line row: the row grows to Self::row_avatar.

§location_min_width: f32

A bar’s location field narrower than this is not shown: the bar keeps its buttons.

§location_comfortable_width: f32

A bar’s actions move into its overflow menu, last first, while its location field would be narrower than this.

§note_wrap_width: f32

Widest a short explanatory sentence (an arrival note, a hint under a heading) runs before it wraps.

§sheet_max_height: f32

The tallest a listing sheet (a directory of workspaces) grows.

§listing_row_height: f32

A listing’s row: a 40 px mark beside a title, a line and who is there.

§face_stack: f32

One face in a row’s stack of who is here now.

§face_stack_step: f32

How far each face in a row’s stack stands past the one before.

§overview_panel_width: f32

The overview’s panel of workspaces beside the picture of the windows.

§overview_picture_min_width: f32

The narrowest picture of the windows worth placing beside the overview’s panel; a narrower display holds it inside the panel.

§row_action_width: f32

A row’s named action button at its trailing end.

§row_arrow: f32

A small arrow button in a row (a placement step).

§row_slider_width: f32

A slider at a row’s trailing end (an app’s volume).

§row_slider_min_width: f32§row_slider_valued_width: f32

A row’s slider with its value beside it (the output volume).

§meter_height: f32

A level meter’s bar, at the default text size.

§chart_height: f32

A pane’s chart (charge history), at the default text size.

§aside_min_width: f32

The narrowest a list beside a figure gets before it moves under it.

§figure_size: f32

A pane’s figure (the time-zone globe), at the default text size.

§picture_tile_min_width: f32

The narrowest picture tile a chooser shows (a theme or wallpaper preview) before its grid drops a column.

§picture_tile_width: f32

The width a picture tile asks for when nothing bounds its grid.

§click_slop: f32

How far a press may move and still be a click.

§drag_line_px: f32

The line a drag draws where the dragged item would land, and the outline of the ghost it carries under the pointer.

Implementations§

§

impl Metrics

pub const BASE: Metrics

HIG §9.6 values, unscaled.

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

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

These metrics with the glyph sizes multiplied by factor; see Self::icon_growth.

pub fn scaled(&self, factor: f32) -> Metrics

Every metric multiplied by factor. Used by ui_scale; never by a custom theme’s spacing preference.

Trait Implementations§

§

impl Clone for Metrics

§

fn clone(&self) -> Metrics

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Metrics

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Metrics

§

fn default() -> Metrics

Returns the “default value” for a type. Read more
§

impl PartialEq for Metrics

§

fn eq(&self, other: &Metrics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for Metrics

§

impl StructuralPartialEq for Metrics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> CommonTraits for T
where T: AsAny + Any + Debug + WasmNotSendSync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,