MCPcopy Create free account
hub / github.com/SharpCoder/teensycore / process

Method process

src/gate.rs:145–168  ·  view source on GitHub ↗

This method will evaluate the current gate condition and, if true, execute the underlying block.

(&mut self)

Source from the content-addressed store, hash-verified

143 // gate condition and, if true, execute
144 // the underlying block.
145 pub fn process(&mut self) {
146
147 // Check if it is valid to process
148 if self.current_index == self.tail && self.sealed {
149 return;
150 }
151
152 let cond = self.conditions.get(self.current_index).unwrap();
153 let then = self.functions.get(self.current_index).unwrap();
154
155 if cond(self) {
156 then();
157 self.current_index += 1;
158
159 if self.current_index == self.tail && self.sealed {
160 return;
161 } else if self.current_index == self.tail {
162 self.current_index = 0;
163 }
164
165 self.target_times.put(self.current_index, nanos() + self.durations.get(self.current_index).unwrap());
166 }
167
168 }
169}
170
171fn when_cond(gate: &mut Gate) -> bool {

Callers 1

compileMethod · 0.80

Calls 3

nanosFunction · 0.85
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected