Skip to main content

Setting

Trait Setting 

Source
pub trait Setting: Sized {
    // Required methods
    fn to_setting(self) -> SettingValue;
    fn from_setting(value: &SettingValue) -> Option<Self>;
}
Expand description

A Rust type that can be read from and written to settings.

Implemented for bool, String, the integer types, f32, f64 and Vec<String>. Integers are stored as i64; a u64 or usize above i64::MAX is stored as i64::MAX.

Required Methods§

Source

fn to_setting(self) -> SettingValue

The stored form.

Source

fn from_setting(value: &SettingValue) -> Option<Self>

Reads a stored value; None when it has another type or does not fit.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Setting for String

Source§

impl Setting for Vec<String>

Source§

impl Setting for bool

Source§

impl Setting for f32

Source§

impl Setting for f64

Source§

impl Setting for i8

Source§

impl Setting for i16

Source§

impl Setting for i32

Source§

impl Setting for i64

Source§

impl Setting for u8

Source§

impl Setting for u16

Source§

impl Setting for u32

Source§

impl Setting for u64

Source§

impl Setting for usize

Implementors§