1
0
Fork 0
forked from wry/wry

vulkan: optimize shm handling

This commit is contained in:
Julian Orth 2024-05-23 22:30:30 +02:00
parent 03c02be34c
commit af80fada6c
14 changed files with 629 additions and 413 deletions

View file

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