1
0
Fork 0
forked from wry/wry

all: remove thread_local feature

This commit is contained in:
Julian Orth 2024-02-22 22:45:46 +01:00
parent 0c3c03b130
commit 53aa762239
9 changed files with 82 additions and 77 deletions

View file

@ -4,18 +4,17 @@ use {
region::{extents, rects_to_bands, subtract, union},
RectRaw,
},
once_cell::unsync::Lazy,
smallvec::SmallVec,
std::{mem, ops::Deref, rc::Rc},
};
#[thread_local]
static EMPTY: Lazy<Rc<Region>> = Lazy::new(|| {
Rc::new(Region {
rects: Default::default(),
extents: Default::default(),
})
});
thread_local! {
static EMPTY: Rc<Region> =
Rc::new(Region {
rects: Default::default(),
extents: Default::default(),
});
}
impl Region {
pub fn new(rect: Rect) -> Rc<Self> {
@ -28,7 +27,7 @@ impl Region {
}
pub fn empty() -> Rc<Self> {
EMPTY.clone()
EMPTY.with(|e| e.clone())
}
pub fn from_rects(rects: &[Rect]) -> Rc<Self> {