MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / count

Method count

atomic-core/src/change/format_v3/semantic/decode.rs:39–50  ·  view source on GitHub ↗
(&mut self, role: usize)

Source from the content-addressed store, hash-verified

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);

Callers 1

Calls 7

numberFunction · 0.85
as_refMethod · 0.80
invalidFunction · 0.70
valueMethod · 0.45
lenMethod · 0.45
remainingMethod · 0.45
chargeMethod · 0.45

Tested by 1