pub trait OptionRefExt {
    type Item;

    fn duped(self) -> Option<Self::Item>
    where
        Self::Item: Dupe
; }
Expand description

Extension traits on Option where it holds a ref.

Required Associated Types

Required Methods

Like cloned, but with a Dupe constraint.

use gazebo::prelude::*;
use std::rc::Rc;
let rc = Rc::new("test");
assert_eq!(Some(&rc).duped(), Some(rc));
assert_eq!(None::<&Rc<String>>.duped(), None);

Implementations on Foreign Types

Implementors