I need to convert different Option Types
from one type into another type.
E.g. Option<f64>
to Option<String>
.
What is the idiomatic way to do this?
My approach:
let f: Option<f64> = Some(4.);
let f_converted = match f {
Some(el) => Some(el.to_string()),
None => None,
};
Is there a better / more idiomatic way to do this?
Thanks!