We had a specific use-case, where for YAML parsing we have a custom type namely "Nullable" as the following structure:
pub enum Nullable<T> {
/// Null value
Null,
/// Value is present
Present(T),
}
This type behaves similar to Option type. Should we move towards generalizing the behaviour of the option type to any type that implements OptionalValue trait, which will define how to extract nested value for any type T.
trait OptionalValue {
type Value;
fn extract(&self) -> Option<Self::Value>;
}
We had a specific use-case, where for YAML parsing we have a custom type namely "Nullable" as the following structure:
This type behaves similar to Option type. Should we move towards generalizing the behaviour of the option type to any type that implements OptionalValue trait, which will define how to extract nested value for any type T.
?