pub trait OptionExt<T> { // Required method fn try_cloned(self) -> Result<Option<T>, Error>; }
Extensions to Option<T>.
Option<T>
Maps an Option<&T> to an Option<T> by cloning the contents of the option.
Option<&T>
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));