pub struct MenuItem<T = ()> {
pub value: T,
pub label: Label,
pub enabled: bool,
pub suffix: Option<(String, SuffixKind)>,
pub note: Option<String>,
}Expand description
One menu entry, standing for a value of the game’s type (() for
a menu whose screen only needs to know an item was chosen).
Fields§
§value: TWhat the item stands for: what MenuEvent::Chosen gives back.
label: LabelText shown: a text key the skin puts in the player’s language, or text as it is.
enabled: boolDisabled items are drawn dim, skipped by the cursor and can’t be chosen.
suffix: Option<(String, SuffixKind)>Text shown after the label (e.g. (broken)), and what it is.
note: Option<String>What the item does, shown under the list while it has the focus (a description in a list).
Implementations§
Source§impl MenuItem
impl MenuItem
Source§impl<T> MenuItem<T>
impl<T> MenuItem<T>
Sourcepub fn with_value<U>(self, value: U) -> MenuItem<U>
pub fn with_value<U>(self, value: U) -> MenuItem<U>
The same item standing for value.
Sourcepub fn with_arg(self, name: impl Into<String>, value: impl Display) -> Self
pub fn with_arg(self, name: impl Into<String>, value: impl Display) -> Self
The same item with the placeholder {name} of its keyed label
filled by value (a label of text as it is stays as it is).
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
The same item, enabled or not.
Sourcepub fn with_suffix(self, text: impl Into<String>, kind: SuffixKind) -> Self
pub fn with_suffix(self, text: impl Into<String>, kind: SuffixKind) -> Self
The same item with text of kind after its label.
Trait Implementations§
impl<T: Eq> Eq for MenuItem<T>
impl<T: PartialEq> StructuralPartialEq for MenuItem<T>
Auto Trait Implementations§
impl<T> Freeze for MenuItem<T>where
T: Freeze,
impl<T> RefUnwindSafe for MenuItem<T>where
T: RefUnwindSafe,
impl<T> Send for MenuItem<T>where
T: Send,
impl<T> Sync for MenuItem<T>where
T: Sync,
impl<T> Unpin for MenuItem<T>where
T: Unpin,
impl<T> UnsafeUnpin for MenuItem<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for MenuItem<T>where
T: UnwindSafe,
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