Skip to main content

SidebarItem

Struct SidebarItem 

Source
pub struct SidebarItem<T: 'static> { /* private fields */ }
Expand description

An item of a Sidebar: a title, the value choosing it gives the sidebar’s selection, and optionally an icon, a subtitle and a context menu.

In view!, its text is its title: <SidebarItem value=Page::General icon="gearshape">"General"</SidebarItem>.

Implementations§

Source§

impl<T: 'static> SidebarItem<T>

Source

pub fn new(title: impl IntoValue<String>, value: T) -> SidebarItem<T>

Source

pub fn value<U: 'static>(self, value: U) -> SidebarItem<U>

The value choosing it gives the sidebar’s selection.

Source

pub fn subtitle(self, subtitle: impl IntoValue<String>) -> SidebarItem<T>

A second line under the title, in the platform’s secondary style (a machine’s system and state, a mailbox’s account). The row is as tall as the two lines need.

Source

pub fn context_menu(self, entries: impl MenuEntries) -> SidebarItem<T>

Its context menu, which the platform shows its own way on the item (a right-click, a long press, the menu key). Takes what ElementBuilder::context_menu takes, with the same reactive titles and states.

Source

pub fn icon(self, name: impl Into<String>) -> SidebarItem<T>

The name of its icon in the platform’s own set, picked with platform!: an SF Symbol on macOS ("gearshape"), a symbolic icon of the theme on GTK and KDE ("preferences-system-symbolic"), a Segoe Fluent Icons glyph on Windows ("\u{E713}"). Empty: none. A platform that can’t find it shows none.

Trait Implementations§

Source§

impl<T: 'static> SidebarEntries<T> for SidebarItem<T>

Source§

fn add_to(self, sections: &mut Vec<SidebarSection<T>>)

Source§

impl<T: 'static> SidebarItems<T> for SidebarItem<T>

Source§

fn add_to(self, items: &mut Vec<SidebarItem<T>>)

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for SidebarItem<T>

§

impl<T> !Send for SidebarItem<T>

§

impl<T> !Sync for SidebarItem<T>

§

impl<T> !UnwindSafe for SidebarItem<T>

§

impl<T> Freeze for SidebarItem<T>
where T: Freeze,

§

impl<T> Unpin for SidebarItem<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for SidebarItem<T>
where T: UnsafeUnpin,

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
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.