1
0
Fork 0
forked from wry/wry

all: add (Clone)Cell::is_some and is_none

This commit is contained in:
Julian Orth 2024-03-02 18:09:40 +01:00
parent 7a67784502
commit 54d93f84da
32 changed files with 98 additions and 62 deletions

16
src/utils/cell_ext.rs Normal file
View file

@ -0,0 +1,16 @@
use std::cell::Cell;
pub trait CellExt {
fn is_some(&self) -> bool;
fn is_none(&self) -> bool;
}
impl<T: Copy> CellExt for Cell<Option<T>> {
fn is_some(&self) -> bool {
self.get().is_some()
}
fn is_none(&self) -> bool {
self.get().is_none()
}
}