Struct ToolbarAction
pub struct ToolbarAction {
pub id: String,
pub icon: String,
pub name: String,
pub enabled: bool,
pub on: bool,
pub toggles: bool,
pub menu: bool,
pub items: Vec<ToolbarAction>,
pub navigates: bool,
pub destructive: bool,
pub labelled: bool,
}Expand description
One action button.
Fields§
§id: StringWhat the app gets back in ToolbarEvent::Action.
icon: StringThe icon, by its icon-set name (crate::icons::Icon::from_name).
name: StringThe outcome it names, for its tooltip and assistive technology.
enabled: boolIt can act now.
on: boolIt is a toggle that is on (a bookmarked page’s star, an open panel).
toggles: boolIt is a toggle, on or off (Self::on): assistive technology
hears it as pressed or not.
It is in the overflow menu only, never a button in the row: an occasional action (import, export, the app’s settings).
items: Vec<ToolbarAction>What a press lists, for a menu button: each item is chosen by its
id (ToolbarEvent::Action); the button’s own id is never sent.
At most MAX_ITEMS, one level deep.
It moves the person through the content (previous, next, back): a leading action that stays in a narrow row after the others and the views have gone into the overflow menu.
destructive: boolIt ends, removes or discards something (leaving a call, deleting): its button has the destructive role’s danger ink, as every other destructive button does.
labelled: boolWhere the row has room it is a text button saying its name, as a calendar’s Today; narrower it is its icon, and then an overflow row, in the row’s fold order.
Implementations§
§impl ToolbarAction
impl ToolbarAction
pub fn new(
id: impl Into<String>,
icon: impl Into<String>,
name: impl Into<String>,
) -> ToolbarAction
pub fn new( id: impl Into<String>, icon: impl Into<String>, name: impl Into<String>, ) -> ToolbarAction
An enabled action button: id comes back in
ToolbarEvent::Action, icon is its icon-set name, name the
outcome it names.
pub fn destructive(self) -> ToolbarAction
pub fn destructive(self) -> ToolbarAction
It ends, removes or discards something (Self::destructive).
pub fn destructive_if(self, when: bool) -> ToolbarAction
pub fn destructive_if(self, when: bool) -> ToolbarAction
It ends, removes or discards something, when when
(Self::destructive).
pub fn with_items(self, items: Vec<ToolbarAction>) -> ToolbarAction
pub fn with_items(self, items: Vec<ToolbarAction>) -> ToolbarAction
A menu button listing items.
pub fn enabled(self, enabled: bool) -> ToolbarAction
pub fn enabled(self, enabled: bool) -> ToolbarAction
Whether it can act now.
pub fn on(self, on: bool) -> ToolbarAction
pub fn on(self, on: bool) -> ToolbarAction
A toggle, on or off.
In the overflow menu only (Self::menu).
It moves through the content (Self::navigates).
pub fn labelled(self) -> ToolbarAction
pub fn labelled(self) -> ToolbarAction
Its name as a text button where the row has room
(Self::labelled).
Trait Implementations§
§impl Clone for ToolbarAction
impl Clone for ToolbarAction
§fn clone(&self) -> ToolbarAction
fn clone(&self) -> ToolbarAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ToolbarAction
impl Debug for ToolbarAction
§impl Default for ToolbarAction
impl Default for ToolbarAction
§fn default() -> ToolbarAction
fn default() -> ToolbarAction
§impl<'de> Deserialize<'de> for ToolbarAction
impl<'de> Deserialize<'de> for ToolbarAction
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolbarAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolbarAction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for ToolbarAction
impl PartialEq for ToolbarAction
§impl Serialize for ToolbarAction
impl Serialize for ToolbarAction
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ToolbarAction
impl StructuralPartialEq for ToolbarAction
Auto Trait Implementations§
impl Freeze for ToolbarAction
impl RefUnwindSafe for ToolbarAction
impl Send for ToolbarAction
impl Sync for ToolbarAction
impl Unpin for ToolbarAction
impl UnsafeUnpin for ToolbarAction
impl UnwindSafe for ToolbarAction
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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