quake_util/common/ext_traits.rs
1use core::cell::Cell;
2
3pub trait CellOptionExt<T> {
4 fn steal(&self) -> T;
5
6 fn into_unwrapped(self) -> T;
7}
8
9impl<T> CellOptionExt<T> for Cell<Option<T>> {
10 fn steal(&self) -> T {
11 self.take().expect("Empty cell option")
12 }
13
14 fn into_unwrapped(self) -> T {
15 self.into_inner().expect("Empty cell option")
16 }
17}