How do I cast optional values in rust?
This is what I came up with, which does work, but I think there must be a more elegant way.
pub fn option_t_to_i32_option<T1, T2>(optional_val: Option<T1>) -> Option<T2>
where
T2: From<T1>,
{
return match optional_val {
Some(val) => Some(T2::from(val)),
None => None,
};
}