1
0

main.rs 987 B

123456789101112131415161718192021222324252627282930313233
  1. use std::{cell::Cell, thread, time::Duration};
  2. use cross_tls_crate::get_bar;
  3. use cross_tls_crate_dylib::get_baz;
  4. fn main() {
  5. dioxus_devtools::connect_subsecond();
  6. loop {
  7. dioxus_devtools::subsecond::call(|| {
  8. use cross_tls_crate::BAR;
  9. use cross_tls_crate_dylib::BAZ;
  10. thread_local! {
  11. pub static FOO: Cell<f32> = const { Cell::new(2.0) };
  12. }
  13. println!("Hello 123s123123s: {}", FOO.get());
  14. get_bar().with(|f| println!("Bar: {:?}", f.borrow()));
  15. thread::sleep(Duration::from_secs(1));
  16. FOO.set(2.0);
  17. get_bar().with(|f| f.borrow_mut().as_mut().unwrap().value = 3.0);
  18. get_baz().with(|f| f.borrow_mut().as_mut().unwrap().value = 4.0);
  19. BAR.with_borrow(|f| {
  20. println!("Bar: {:?}", f);
  21. });
  22. BAZ.with_borrow(|f| {
  23. println!("Baz: {:?}", f);
  24. });
  25. });
  26. }
  27. }