1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Use explicit Arc::clone to clarify when clones are cheap (#7784)

This commit is contained in:
Emil Ernerfeldt
2025-12-17 17:19:18 +01:00
committed by GitHub
parent 6157a35985
commit 986c2c0ffb
40 changed files with 80 additions and 71 deletions

View File

@@ -1,8 +1,10 @@
use eframe::{EframePumpStatus, UserEvent, egui};
use std::{cell::Cell, io, os::fd::AsRawFd as _, rc::Rc, time::Duration};
use tokio::task::LocalSet;
use winit::event_loop::{ControlFlow, EventLoop};
use eframe::{EframePumpStatus, UserEvent, egui};
pub fn run() -> io::Result<()> {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let options = eframe::NativeOptions {
@@ -85,7 +87,7 @@ impl eframe::App for MyApp {
self.value.set(self.value.get() + 1);
}
if ui.button("Increment Later").clicked() {
let value = self.value.clone();
let value = Rc::clone(&self.value);
let ctx = ui.ctx().clone();
tokio::task::spawn_local(async move {
tokio::time::sleep(Duration::from_secs(1)).await;