Skip to content
Discussion options

You must be logged in to vote

Mhh, we only progress from one problem to another. This is an particularly unpleasant problem in Rust and something I deal with rarely (which is why it took me so long to remember all the details).

I hope I've now considered all the potential problems. I think there are two possibilities:

  • Use thread_local and then .with(|w| w.clone()) to access the widgets (since widgets can be cloned cheaply as they are smart pointers like Rc)
  • Use a static sync::LazyLock with either Mutex or Fragile

Both solutions are not ideal, but somehow you have to satisfy the constraints of the compiler.

Replies: 1 comment 16 replies

Comment options

You must be logged in to vote
16 replies
@chrsoo
Comment options

@AaronErhardt
Comment options

@chrsoo
Comment options

@AaronErhardt
Comment options

Answer selected by chrsoo
@chrsoo
Comment options

@AaronErhardt
Comment options

@chrsoo
Comment options

@chrsoo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants