pub trait FromOptionValue: Sized {
    // Required methods
    fn from_option_value(
        name: &'static str,
        option: &CommandDataOptionValue
    ) -> Result<Self, ConvertError>;
    fn get_expected_data_type() -> DataType;

    // Provided method
    fn get_missing_default() -> Option<Self> { ... }
}
Expand description

Convert from an option value

Required Methods§

source

fn from_option_value( name: &'static str, option: &CommandDataOptionValue ) -> Result<Self, ConvertError>

Parse from an option value

source

fn get_expected_data_type() -> DataType

The expected data type

Provided Methods§

source

fn get_missing_default() -> Option<Self>

Kind of a hack to get the default “missing” value if the key was not present.

Returns

Returns None if this type is not optional.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromOptionValue for bool

source§

impl FromOptionValue for String

source§

impl<T> FromOptionValue for Option<T>where T: FromOptionValue,

Implementors§