Describe the feature you'd like
Implicitly converting value to Some(value) for a prop with type of Option<T>. Consider the following props
struct Props {
#[prop_or_default]
pub foo: Option<String>
}
If no prop value is passed for foo then that field will be initialized as None but when a value is to be passed, it must be passed as foo=Some(value). It should be able to be passed as foo=value where value has a type of String (&str) and an implicit conversion should occur which converts to Some(value). This is similar to conversion between String and &str.
Is your feature request related to a problem? Please describe.
Converting to Some when passing value to Option<T> props can get repetitive and can be abstracted away similar to conversion between String and &str.
Describe alternatives you've considered
Doing Some(value) every single time.
Additional context
None, that I can think of.
Questionnaire
Describe the feature you'd like
Implicitly converting
valuetoSome(value)for a prop with type ofOption<T>. Consider the following propsIf no prop value is passed for
foothen that field will be initialized asNonebut when a value is to be passed, it must be passed asfoo=Some(value). It should be able to be passed asfoo=valuewherevaluehas a type ofString(&str) and an implicit conversion should occur which converts toSome(value). This is similar to conversion betweenStringand&str.Is your feature request related to a problem? Please describe.
Converting to
Somewhen passing value toOption<T>props can get repetitive and can be abstracted away similar to conversion betweenStringand&str.Describe alternatives you've considered
Doing
Some(value)every single time.Additional context
None, that I can think of.
Questionnaire
...and also my knowledge of proc macros is too limited to efficiently work on this