Skip to main content

ToolbarEntry

Struct ToolbarEntry 

Source
pub struct ToolbarEntry { /* private fields */ }
Expand description

A toolbar item under construction. Build a command with toolbar_button, a two-state button with toolbar_toggle, a pull-down with toolbar_menu, a search field with toolbar_search, and the gaps with toolbar_space / toolbar_flexible_space.

Implementations§

Source§

impl ToolbarEntry

Source

pub fn action(self, f: impl Fn() + 'static) -> ToolbarEntry

Run f when the item is chosen. On a toggle or a search field the value binding carries the change; an action here runs in addition to it.

Source

pub fn icon(self, symbol: Symbol) -> ToolbarEntry

Draw a standard Symbol, using the platform’s own icon set — an SF Symbol on macOS, a freedesktop icon name on GTK and Qt, a Fluent glyph on Windows.

Source

pub fn image(self, name: impl Into<ImageName>) -> ToolbarEntry

Draw a bundled image from resource/images — for an icon only this app has. Prefer ToolbarEntry::icon for anything standard: one PNG cannot look native on four desktops.

Source

pub fn tooltip<M>(self, t: impl IntoText<M>) -> ToolbarEntry

Hover help. Defaults to the item’s label.

Source

pub fn placeholder<M>(self, t: impl IntoText<M>) -> ToolbarEntry

The empty-state prompt of a search item (ignored on other kinds).

Source

pub fn enabled(self, on: bool) -> ToolbarEntry

Enable or disable the item once, at build.

Source

pub fn enabled_when(self, f: impl Fn() -> bool + 'static) -> ToolbarEntry

Enable the item while f reads true, re-evaluated whenever its reactive reads change. This is the live path: it patches the one item rather than rebuilding the bar, so a command greying out never disturbs a search field mid-word.

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
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> 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
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> ErasedDestructor for T
where T: 'static,

Day API ↩ Guides· daybrite.dev