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

Method charge

atomic-core/src/change/format_v3/graph_fields/raw.rs:15–26  ·  view source on GitHub ↗
(&self, n: usize)

Source from the content-addressed store, hash-verified

13}
14impl Budget {
15 fn charge<E: de::Error>(&self, n: usize) -> Result<(), E> {
16 match self.remaining.get().checked_sub(n) {
17 Some(left) => {
18 self.remaining.set(left);
19 Ok(())
20 }
21 None => {
22 self.exceeded.set(true);
23 Err(E::custom("graph allocation budget"))
24 }
25 }
26 }
27}
28struct Guard<'a, D> {
29 inner: D,

Callers 8

visit_strMethod · 0.45
visit_borrowed_strMethod · 0.45
visit_stringMethod · 0.45
visit_bytesMethod · 0.45
visit_borrowed_bytesMethod · 0.45
visit_byte_bufMethod · 0.45
next_element_seedMethod · 0.45
next_key_seedMethod · 0.45

Calls 3

customFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected