futursolo / stylist-rs

A CSS-in-Rust styling solution for WebAssembly Applications
https://crates.io/crates/stylist
MIT License
370 stars 22 forks source link

Make Style !Send and !Sync? #19

Closed futursolo closed 3 years ago

futursolo commented 3 years ago

Currently, Style is Send and Sync primarily due to it needs to be held in the StyleRegistry which is internally Arc<Mutex<X>>.

However, it prevents Style and the upcoming StyleManager from holding any elements from web-sys which is a trade off that I consider to be big enough.

This issue aims to investigate whether is worth to make StyleRegistry thread local with Rc<RefCell<X>> and Style !Send and !Sync so elements can be held in them.

futursolo commented 3 years ago

This is addressed in branch manager.

It does make sense to make Style !Send and !Sync given its underlying <style /> element is currently !Send and !Sync.