Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern cannot be shared between threads safely #5

Open
m-kuzmin opened this issue Jun 15, 2022 · 0 comments
Open

Pattern cannot be shared between threads safely #5

m-kuzmin opened this issue Jun 15, 2022 · 0 comments

Comments

@m-kuzmin
Copy link

error[E0277]: `Rc<kuchiki::tree::Node>` cannot be shared between threads safely
  --> src/websites/gogoplay/parsers.rs:11:20
   |
11 |     static PARSER: OnceCell<Pattern> = Pattern::new(
   |                    ^^^^^^^^^^^^^^^^^ `Rc<kuchiki::tree::Node>` cannot be shared between threads safely
   |
   = help: within `easy_scraper::Pattern`, the trait `Sync` is not implemented for `Rc<kuchiki::tree::Node>`
   = note: required because it appears within the type `kuchiki::tree::NodeRef`
   = note: required because it appears within the type `easy_scraper::Pattern`
   = note: required because of the requirements on the impl of `Sync` for `once_cell::imp::OnceCell<easy_scraper::Pattern>`
   = note: required because it appears within the type `once_cell::sync::OnceCell<easy_scraper::Pattern>`
   = note: shared static variables must have a type that implements `Sync`

A thread safe version would be very usefull for keeping a static OnceCell to prevent recompiling the same pattern over and over again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant