pub struct StatusItemsBuilder { /* private fields */ }Expand description
A fluent builder for one def’s Vec<StatusItem>.
Obtain one from the closure argument of StatusDefListBuilder::def_all or
StatusDefListBuilder::def_one_of, then chain calls to item,
key_item, and raw. The builder is consumed
by each call and returned, so the chain reads left-to-right in the order items
appear on screen. Call build (or let the outer builder call it
for you) to produce the finished Vec<StatusItem>.
Implementations§
Source§impl StatusItemsBuilder
impl StatusItemsBuilder
Sourcepub fn item(
self,
text: impl Into<String>,
key_code: impl Into<Option<KeyEvent>>,
command: Command,
) -> Self
pub fn item( self, text: impl Into<String>, key_code: impl Into<Option<KeyEvent>>, command: Command, ) -> Self
Append a visible item (label, optional accelerator, command).
Sourcepub fn key_item(
self,
key_code: impl Into<Option<KeyEvent>>,
command: Command,
) -> Self
pub fn key_item( self, key_code: impl Into<Option<KeyEvent>>, command: Command, ) -> Self
Append a hidden hotkey binding (no text).
Sourcepub fn raw(self, item: StatusItem) -> Self
pub fn raw(self, item: StatusItem) -> Self
Append an already-built StatusItem — the escape hatch.
Sourcepub fn build(self) -> Vec<StatusItem>
pub fn build(self) -> Vec<StatusItem>
Finish and produce the Vec<StatusItem>.
Trait Implementations§
Source§impl Default for StatusItemsBuilder
impl Default for StatusItemsBuilder
Source§fn default() -> StatusItemsBuilder
fn default() -> StatusItemsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StatusItemsBuilder
impl RefUnwindSafe for StatusItemsBuilder
impl Send for StatusItemsBuilder
impl Sync for StatusItemsBuilder
impl Unpin for StatusItemsBuilder
impl UnsafeUnpin for StatusItemsBuilder
impl UnwindSafe for StatusItemsBuilder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.