Struct NavItem
pub struct NavItem {Show 20 fields
pub id: String,
pub label: String,
pub icon: Option<Icon>,
pub count: Option<NavCount>,
pub actions: bool,
pub children: Vec<NavItem>,
pub expanded: bool,
pub ensure_expanded: bool,
pub drop_target: bool,
pub editable_label: bool,
pub secondary: Option<String>,
pub meta: Option<String>,
pub status: Option<NavItemStatus>,
pub status_label: Option<(String, Tone)>,
pub badge: Option<String>,
pub swatch: Option<AlphaColor<Srgb>>,
pub checked: Option<bool>,
pub level: Option<f32>,
pub presence: Vec<String>,
pub semantic_key: Option<String>,
}Expand description
One destination. Every part but the label is optional; see
docs/ui-migration.md, “Rows: what each part of a NavItem means”.
Fields§
§id: StringStable across rebuilds; selection, expansion and focus follow it.
label: String§icon: Option<Icon>§count: Option<NavCount>§actions: boolShow the list’s item actions (NavList::item_actions) on this row
on hover and focus.
children: Vec<NavItem>Nested destinations, indented one step.
expanded: boolStarts expanded (only meaningful with children).
ensure_expanded: boolOpens even where the person folded it (the place the app just revealed).
drop_target: boolOther items may be dragged into this one (NavList::on_move).
editable_label: boolThe label can be renamed in place (NavList::on_rename).
secondary: Option<String>§meta: Option<String>§status: Option<NavItemStatus>§status_label: Option<(String, Tone)>§badge: Option<String>§swatch: Option<AlphaColor<Srgb>>§checked: Option<bool>§level: Option<f32>§presence: Vec<String>§semantic_key: Option<String>The key assistive technology and tests address the row by; the
default is nav:item:{id}.
Implementations§
pub fn new(id: impl Into<String>, label: impl Into<String>) -> NavItem
pub fn icon(self, icon: Icon) -> NavItem
pub fn live_count(self, count: u32) -> NavItem
pub fn live_count(self, count: u32) -> NavItem
A count that wants attention (unread, mentions): the list’s one filled badge, in the person’s colour. Zero shows nothing.
pub fn children(self, children: Vec<NavItem>) -> NavItem
pub fn expanded(self) -> NavItem
pub fn ensure_expanded(self) -> NavItem
pub fn ensure_expanded(self) -> NavItem
Open this item whenever the sections are handed over, even where the person folded it: the place the app is revealing (the database a connection just opened).
pub fn drop_target(self) -> NavItem
pub fn editable_label(self) -> NavItem
pub fn without_actions(self) -> NavItem
pub fn without_actions(self) -> NavItem
This row offers none of the list’s item actions.
pub fn secondary(self, text: impl Into<String>) -> NavItem
pub fn secondary(self, text: impl Into<String>) -> NavItem
One Caption line under the label (a host and port, a schedule).
It elides; the row grows to hold it.
pub fn meta(self, text: impl Into<String>) -> NavItem
pub fn meta(self, text: impl Into<String>) -> NavItem
A tertiary figure at the trailing edge (a size).
pub fn status(self, status: RowStatus<'_>) -> NavItem
pub fn status(self, status: RowStatus<'_>) -> NavItem
A status dot at the trailing edge: a drive’s health, a connection’s state, an account that needs attention, a person’s presence.
pub fn status_label(self, label: impl Into<String>, tone: Tone) -> NavItem
pub fn status_label(self, label: impl Into<String>, tone: Tone) -> NavItem
A quiet tinted badge naming the row’s state (“Active”).
pub fn badge(self, code: impl Into<String>) -> NavItem
pub fn badge(self, code: impl Into<String>) -> NavItem
A short leading code that classifies the row (GET, POST). The
codes of one section share a column, so their labels line up.
pub fn swatch(self, color: AlphaColor<Srgb>) -> NavItem
pub fn swatch(self, color: AlphaColor<Srgb>) -> NavItem
The content colour the row stands for (a calendar, a project), in the icon’s place.
pub fn checked(self, checked: bool) -> NavItem
pub fn checked(self, checked: bool) -> NavItem
A checkbox in the leading slot (a calendar shown or hidden). The
whole row toggles it and reports through NavList::on_check; a
checkable row is not a destination and is never selected.
pub fn level(self, fraction: f32) -> NavItem
pub fn level(self, fraction: f32) -> NavItem
A usage bar under the label, fraction of it filled (a backup
destination’s space).
pub fn presence(self, identity: impl Into<String>) -> NavItem
pub fn presence(self, identity: impl Into<String>) -> NavItem
Someone is on this place: a mark in their presence colour. Call once per person.
pub fn semantic_key(self, key: impl Into<String>) -> NavItem
pub fn semantic_key(self, key: impl Into<String>) -> NavItem
The key assistive technology, agents and tests address the row by.
Trait Implementations§
Auto Trait Implementations§
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