This method will evaluate the current gate condition and, if true, execute the underlying block.
(&mut self)
| 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 | |
| 171 | fn when_cond(gate: &mut Gate) -> bool { |