pub trait OptionExt<T> {
// Required method
fn try_cloned(self) -> Result<Option<T>, Error>;
}
Expand description
Maps an Option<&T>
to an Option<T>
by cloning the contents of the
option.
§Examples
use rune::alloc::prelude::*;
let x = 12u32;
let opt_x = Some(&x);
assert_eq!(opt_x, Some(&12));
let cloned = opt_x.try_cloned()?;
assert_eq!(cloned, Some(12u32));