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§
sourcefn from_option_value(
name: &'static str,
option: &CommandDataOptionValue
) -> Result<Self, ConvertError>
fn from_option_value( name: &'static str, option: &CommandDataOptionValue ) -> Result<Self, ConvertError>
Parse from an option value
sourcefn get_expected_data_type() -> DataType
fn get_expected_data_type() -> DataType
The expected data type
Provided Methods§
sourcefn get_missing_default() -> Option<Self>
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.