Trait ConfigType

Source
pub trait ConfigType:
    Into<ConfigVal>
    + Clone
    + Sized {
    // Required methods
    fn from_val(val: ConfigVal) -> Self;
    fn parse(s: &str) -> Result<Self, String>;
}
Expand description

A type usable as a Config.

Required Methods§

Source

fn from_val(val: ConfigVal) -> Self

Converts a type-erased enum value to this type.

Panics if the enum’s variant does not match this type.

Source

fn parse(s: &str) -> Result<Self, String>

Parses this string slice into a ConfigType.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ConfigType for Value

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for Option<usize>

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for bool

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for f64

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for u32

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for usize

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for String

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Source§

impl ConfigType for Duration

Source§

fn from_val(val: ConfigVal) -> Self

Source§

fn parse(s: &str) -> Result<Self, String>

Implementors§