/// Replaces the contents of the `MapCell` with `val`. If the cell was not
/// empty, the previous value is returned, otherwise `None` is returned.
Replaces the contents of the `MapCell` with `val`. If the cell was not
empty, the previous value is returned, otherwise `None` is returned.
Replaces the contents of the ` MapCell ` with ` val ` . If the cell was not empty the previous value is returned otherwise ` None ` is returned .
pub fn replace(&self, val: T) -> Option<T> {
        if self.is_some() {
            unsafe { Some(ptr::replace(self.val.get(), U { some: val }).some) }
        } else {
            self.put(val);
            None
        }
    }
pub fn replace ( & self , val : T ) -> Option < T > { if self . is_some ( ) { unsafe { Some ( ptr :: replace ( self . val . get ( ) , U { some : val } ) . some ) } } else { self . put ( val ) ; None } }
Replaces the contents of the `MapCell` with `val`.
Replaces the contents of the ` MapCell ` with ` val ` .
&self
val
T