MCPcopy Create free account
hub / github.com/RustOtomeLab/RustEng / start_timer

Method start_timer

src/executors/text_executor.rs:57–80  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

55 }
56
57 pub(crate) fn start_timer(&mut self) {
58 let weak = self.weak.clone();
59 let rx = self.text_rx.take().unwrap();
60
61 self.timer.start(
62 slint::TimerMode::Repeated,
63 Duration::from_millis(20),
64 move || {
65 if let Ok(text) = rx.try_recv() {
66 let mut parts = text.split("{nns}").map(str::trim);
67 let (t1, t2, t3) = (
68 parts.next().unwrap_or(""),
69 parts.next().unwrap_or(""),
70 parts.next().unwrap_or(""),
71 );
72 if let Some(window) = weak.upgrade() {
73 window.set_dialogue_1(t1.to_shared_string());
74 window.set_dialogue_2(t2.to_shared_string());
75 window.set_dialogue_3(t3.to_shared_string());
76 }
77 }
78 },
79 );
80 }
81}
82
83pub(crate) type TextTX = Sender<Arc<RwLock<DisplayText>>>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected