Skip to main content

Key

Struct Key 

Source
pub struct Key<T> {
    pub d: Desc,
    /* private fields */
}
Expand description

a typed key: its description (d) and the Rust type of its value

Fields§

§d: Desc

Implementations§

Source§

impl Key<bool>

Source

pub const fn bool(name: &'static str, def: bool) -> Key<bool>

Source§

impl Key<i64>

Source

pub const fn int(name: &'static str, def: i64, min: i64, max: i64) -> Key<i64>

a whole number in min..=max (step 1)

Source

pub const fn step(self, step: i64) -> Key<i64>

the step of the number box’s arrows and arrow keys

Source§

impl Key<f64>

Source

pub const fn num( name: &'static str, def: f64, min: f64, max: f64, dec: u32, ) -> Key<f64>

a number in min..=max, shown with dec decimals

Source§

impl Key<String>

Source

pub const fn text( name: &'static str, def: &'static str, max: usize, ) -> Key<String>

a text of at most max bytes (UTF-8)

Source§

impl Key<usize>

Source

pub const fn choice( name: &'static str, def: usize, items: &'static [(&'static str, &'static str)], ) -> Key<usize>

one of items (stored word, label); the value is its index

Source§

impl Key<u32>

Source

pub const fn color(name: &'static str, def: u32) -> Key<u32>

a colour 0xRRGGBB

Source§

impl<T> Key<T>

Source

pub const fn label(self, label: &'static str) -> Key<T>

the text of the settings page (default: the name)

Source

pub const fn help(self, help: &'static str) -> Key<T>

a line of explanation below the label

Source

pub const fn hidden(self) -> Key<T>

not on the settings page (state the app keeps)

Source

pub const fn restart(self) -> Key<T>

takes effect after a restart

Trait Implementations§

Source§

impl<T> Clone for Key<T>

Source§

fn clone(&self) -> Key<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Copy for Key<T>

Auto Trait Implementations§

§

impl<T> Forget for Key<T>

§

impl<T> Freeze for Key<T>
where PhantomData<fn() -> T>: Freeze,

§

impl<T> RefUnwindSafe for Key<T>
where PhantomData<fn() -> T>: RefUnwindSafe,

§

impl<T> Send for Key<T>
where PhantomData<fn() -> T>: Send,

§

impl<T> Sync for Key<T>
where PhantomData<fn() -> T>: Sync,

§

impl<T> Unpin for Key<T>
where PhantomData<fn() -> T>: Unpin,

§

impl<T> UnsafeUnpin for Key<T>
where PhantomData<fn() -> T>: UnsafeUnpin,

§

impl<T> UnwindSafe for Key<T>
where PhantomData<fn() -> T>: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.