I have a candle_series of the type Vec<Candle> that gets the last element and I try to use unwrap_or_default:
self.candle_series.last().unwrap_or_default()
But then I get this error:
method not found in `std::option::Option<&market::Candle>
How can I get the behaviour of unwrap_or_default on the struct instead of the reference?
My current workaround is this but it seems incorrect. If it is correct, please let me know:
self.candle_series.last().unwrap_or(&Candle::default())