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

Method reserve

atomic-core/src/operation/codec.rs:289–301  ·  view source on GitHub ↗
(&self, additional: usize)

Source from the content-addressed store, hash-verified

287 }
288
289 fn reserve(&self, additional: usize) -> Result<(), OperationCodecError> {
290 let total = self
291 .bytes
292 .len()
293 .checked_add(additional)
294 .ok_or_else(|| OperationCodecError::new("canonical object length overflow"))?;
295 if total > MAX_OPERATION_OBJECT_BYTES {
296 return Err(OperationCodecError::new(format!(
297 "canonical operation object exceeds {MAX_OPERATION_OBJECT_BYTES} bytes"
298 )));
299 }
300 Ok(())
301 }
302
303 fn put_bytes(&mut self, bytes: &[u8]) -> Result<(), OperationCodecError> {
304 self.reserve(bytes.len())?;

Callers 1

put_bytesMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected