CoreSettingItem

Enum CoreSettingItem 

Source
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

§id: SettingId

A unique ID for this page.

§label: String

The label that would be shown in a top-level menu.

§title: String

The title of this menu. Can be different than label.

§items: Vec<CoreSettingItem>

Menu Items contained by this menu.

§disabled: bool

Whether this page is disabled from being selected.

§

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.

Fields

§selectable: bool
§label: String
§disabled: bool
§

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.

Fields

§label: String
§extensions: Vec<String>
§disabled: bool
§

Trigger

A trigger that can be used to perform an action.

Fields

§label: String
§disabled: bool
§

BoolOption

An option that can be selected by the user and contains a boolean value (on or off).

Fields

§label: String
§value: bool
§disabled: bool
§

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).

Fields

§label: String
§choices: Vec<String>
§value: usize
§disabled: bool

Implementations§

Source§

impl CoreSettingItem

Source

pub fn with_disabled(self, disabled: bool) -> Self

Source

pub fn set_disable(&mut self, new_disabled: bool)

Source

pub fn page( id: impl Into<SettingId>, label: &str, title: &str, items: Vec<CoreSettingItem>, ) -> Self

Source

pub fn items(&self) -> Option<&Vec<CoreSettingItem>>

Source

pub fn items_mut(&mut self) -> Option<&mut Vec<CoreSettingItem>>

Source

pub fn separator() -> Self

Source

pub fn label(selectable: bool, label: &str) -> Self

Source

pub fn file_select( id: impl Into<SettingId>, label: &str, extensions: Vec<String>, ) -> Self

Source

pub fn trigger(id: impl Into<SettingId>, label: &str) -> Self

Source

pub fn bool_option( id: impl Into<SettingId>, label: &str, value: Option<bool>, ) -> Self

Source

pub fn int_option( id: impl Into<SettingId>, label: &str, choices: Vec<String>, value: Option<usize>, ) -> Self

Source

pub fn add_item(&mut self, sub: CoreSettingItem)

Trait Implementations§

Source§

impl Debug for CoreSettingItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for CoreSettingItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.