(&mut self, role: usize)
| 37 | } |
| 38 | } |
| 39 | fn count<T: AllocationCost>(&mut self, role: usize) -> FormatResult<usize> { |
| 40 | let n = number(self.value(role)?)?; |
| 41 | let available = self |
| 42 | .predictive |
| 43 | .as_ref() |
| 44 | .map_or(self.c.control.len(), |p| p.remaining()); |
| 45 | if n > available { |
| 46 | return Err(invalid("count exceeds control stream")); |
| 47 | } |
| 48 | self.charge(n, T::COST)?; |
| 49 | Ok(n) |
| 50 | } |
| 51 | fn flag(&mut self, role: usize) -> FormatResult<bool> { |
| 52 | if self.predictive.is_none() { |
| 53 | return flag(&mut self.c.control); |