Skip to main content

Action

Struct Action 

Source
pub struct Action<M> { /* private fields */ }
Expand description

Something the widget can do, from Widget::actions, for the dormer: the host’s search dialog. Typing finds it by its title, subtitle and keywords, and picking it sends message to the widget.

Implementations§

Source§

impl<M> Action<M>

Source

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

Its name, for eave action <widget> <id> and for keys in config.toml. Give one to every action that’s always there, like mute; leave it out on ones that come and go, like a window to switch to.

Source

pub fn shortcut(self, key: Shortcut) -> Self

A key that runs it while the dormer is open, shown at its row’s end. It needs Ctrl, Alt or Super, since the dormer’s field has the keys that type, and an id, which the user can give it another key by. When two widgets’ actions want the same key, the widget earlier in config.toml keeps it.

Source

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

A line under the title: what it acts on, or what kind of thing it is.

Source

pub fn keywords( self, words: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Other words it should be found by, not shown.

Source

pub fn leading(self, node: Node<M>) -> Self

A small picture before the title: an icon, app_icon, image or symbol.

Source

pub fn map<N: 'static>( self, f: &(impl Fn(M) -> N + Clone + 'static), ) -> Action<N>
where M: 'static,

Source

pub fn title(&self) -> &str

Auto Trait Implementations§

§

impl<M> !RefUnwindSafe for Action<M>

§

impl<M> !Send for Action<M>

§

impl<M> !Sync for Action<M>

§

impl<M> !UnwindSafe for Action<M>

§

impl<M> Freeze for Action<M>
where Option<Node<M>>: Freeze, M: Freeze,

§

impl<M> Unpin for Action<M>
where Option<Node<M>>: Unpin, M: Unpin,

§

impl<M> UnsafeUnpin for Action<M>

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.