MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / update

Method update

examples/bad_apple.rs:87–114  ·  view source on GitHub ↗
(&mut self, message: Message, now: Instant)

Source from the content-addressed store, hash-verified

85 }
86
87 fn update(&mut self, message: Message, now: Instant) {
88 match message {
89 Message::PlotMessage(plot_msg) => {
90 self.widget.update(plot_msg);
91 }
92 Message::Tick => {
93 if self.frame_count == 0 {
94 return;
95 }
96 let elapsed = match self.last_tick {
97 Some(prev) => now.saturating_duration_since(prev),
98 None => Duration::ZERO,
99 };
100 self.last_tick = Some(now);
101 self.accumulator += elapsed;
102
103 let mut steps = 0usize;
104 while self.accumulator >= self.frame_duration {
105 self.accumulator -= self.frame_duration;
106 steps += 1;
107 }
108 if steps > 0 {
109 self.frame_idx = (self.frame_idx + steps) % self.frame_count;
110 self.update_frame();
111 }
112 }
113 }
114 }
115
116 fn update_frame(&mut self) {
117 if self.frame_count == 0 {

Callers

nothing calls this directly

Calls 1

update_frameMethod · 0.80

Tested by

no test coverage detected