pub enum CoreSettingItem {
Page {
id: SettingId,
label: String,
title: String,
items: Vec<CoreSettingItem>,
disabled: bool,
},
Separator,
Label {
selectable: bool,
label: String,
disabled: bool,
},
FileSelect {
id: SettingId,
label: String,
extensions: Vec<String>,
disabled: bool,
},
Trigger {
id: SettingId,
label: String,
disabled: bool,
},
BoolOption {
id: SettingId,
label: String,
value: bool,
disabled: bool,
},
IntOption {
id: SettingId,
label: String,
choices: Vec<String>,
value: usize,
disabled: bool,
},
}Expand description
A core setting item that can be displayed in the core’s setting menu. This is used to configure the core’s settings, in an abstract way.
Please note that a core can create menu items that don’t have actual effect on the core’s behavior.
Variants§
Page
A menu page that contains more menu items. This is purely cosmetic.
Fields
items: Vec<CoreSettingItem>Menu Items contained by this menu.
Separator
A separator (horizontal line normally). Cosmetic.
Label
A simple label that might be selectable, but is not considered actionable. This is used to display information to the user.
FileSelect
A file select menu item that can be used to select a file from the file system. This is used to load files into the core.
Trigger
A trigger that can be used to perform an action.
BoolOption
An option that can be selected by the user and contains a boolean value (on or off).
IntOption
An option that can be selected by the user and contains an integer value. This is used for options that have a range of values, but can also represent options with 2 choices.
It is an error to have choices less than 2 items (and will result in an error when dealing with core menus).
Implementations§
Source§impl CoreSettingItem
impl CoreSettingItem
pub fn with_disabled(self, disabled: bool) -> Self
pub fn set_disable(&mut self, new_disabled: bool)
pub fn page( id: impl Into<SettingId>, label: &str, title: &str, items: Vec<CoreSettingItem>, ) -> Self
pub fn items(&self) -> Option<&Vec<CoreSettingItem>>
pub fn items_mut(&mut self) -> Option<&mut Vec<CoreSettingItem>>
pub fn separator() -> Self
pub fn label(selectable: bool, label: &str) -> Self
pub fn file_select( id: impl Into<SettingId>, label: &str, extensions: Vec<String>, ) -> Self
pub fn trigger(id: impl Into<SettingId>, label: &str) -> Self
pub fn bool_option( id: impl Into<SettingId>, label: &str, value: Option<bool>, ) -> Self
pub fn int_option( id: impl Into<SettingId>, label: &str, choices: Vec<String>, value: Option<usize>, ) -> Self
pub fn add_item(&mut self, sub: CoreSettingItem)
Trait Implementations§
Source§impl Debug for CoreSettingItem
impl Debug for CoreSettingItem
Auto Trait Implementations§
impl Freeze for CoreSettingItem
impl RefUnwindSafe for CoreSettingItem
impl Send for CoreSettingItem
impl Sync for CoreSettingItem
impl Unpin for CoreSettingItem
impl UnwindSafe for CoreSettingItem
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
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