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

Method put_count

atomic-core/src/operation/codec.rs:325–334  ·  view source on GitHub ↗
(&mut self, count: usize, field: &str)

Source from the content-addressed store, hash-verified

323 }
324
325 fn put_count(&mut self, count: usize, field: &str) -> Result<(), OperationCodecError> {
326 if count > MAX_OPERATION_COLLECTION_ITEMS {
327 return Err(OperationCodecError::new(format!(
328 "{field} has {count} items, maximum is {MAX_OPERATION_COLLECTION_ITEMS}"
329 )));
330 }
331 let count = u32::try_from(count)
332 .map_err(|_| OperationCodecError::new(format!("{field} count exceeds u32")))?;
333 self.put_u32(count)
334 }
335
336 fn put_string(&mut self, value: &str, field: &str) -> Result<(), OperationCodecError> {
337 if value.is_empty() {

Callers 4

encode_operation_payloadFunction · 0.80
encode_operation_headsFunction · 0.80
put_repo_state_deltaMethod · 0.80
put_loss_noteMethod · 0.80

Calls 1

put_u32Method · 0.80

Tested by

no test coverage detected