Say I have an Option
of Rc
:
let x = Some(Rc::new(3));
If I need to make a clone, I can do:
let y = Some(Rc::clone(&x.unwrap()));
But it seems there's also a short cut:
let y = x.clone();
Are there any difference between these options? Or they are internally doing the same thing?
unwrap()
, but yes if you think on happy path they do the same – Bilocular