1
0
Fork 0
forked from wry/wry
wry/src/utils/cell_ext.rs
2024-05-23 22:30:38 +02:00

16 lines
332 B
Rust

use {crate::utils::ptr_ext::PtrExt, std::cell::Cell};
pub trait CellExt {
fn is_some(&self) -> bool;
fn is_none(&self) -> bool;
}
impl<T> CellExt for Cell<Option<T>> {
fn is_some(&self) -> bool {
unsafe { self.as_ptr().deref().is_some() }
}
fn is_none(&self) -> bool {
!self.is_some()
}
}