Skip to main content

ToolbarAction

Struct ToolbarAction 

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

One command of a Toolbar.

Implementations§

Source§

impl ToolbarAction

Source

pub fn new(label: impl Into<String>) -> Self

A ghost button with this text.

Source

pub fn accessible_name(self, name: impl Into<String>) -> Self

What screen readers call it, instead of its label.

Source

pub fn accessible_description(self, text: impl Into<String>) -> Self

What screen readers say after its name. Its keys follow, when it has them.

Source

pub fn icon(self, icon: IconName) -> Self

An icon before the label.

Source

pub fn icon_only(self) -> Self

Shows only the icon; the label stays as its name, and in the overflow menu.

Source

pub fn style(self, style: ButtonStyle) -> Self

The button’s style. Ghost by default.

Source

pub fn disabled(self, disabled: bool) -> Self

Greys the command out. It keeps its place, so its neighbors do not move under the pointer, but it is left out of the overflow menu.

Source

pub fn hotkey(self, hotkey: Hotkey) -> Self

Runs the command with these keys, also from the overflow menu’s place, and shows them there. Off while the command is disabled.

Source

pub fn on_click(self, handler: impl Fn() + 'static) -> Self

Runs handler when the command is chosen.

Trait Implementations§

Source§

impl Debug for ToolbarAction

Source§

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

Formats the value using the given formatter. Read more

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
§

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

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