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

Function encode_option_ref

atomic-core/src/pristine/ref_mapping.rs:373–382  ·  view source on GitHub ↗
(bytes: &mut Vec<u8>, value: Option<&str>)

Source from the content-addressed store, hash-verified

371}
372
373fn encode_option_ref(bytes: &mut Vec<u8>, value: Option<&str>) -> PristineResult<()> {
374 match value {
375 None => bytes.push(0),
376 Some(value) => {
377 bytes.push(1);
378 encode_len_prefixed(bytes, value.as_bytes())?;
379 }
380 }
381 Ok(())
382}
383
384type Take<'a> = dyn FnMut(usize) -> Result<&'a [u8], PristineError> + 'a;
385

Callers 1

encodeMethod · 0.85

Calls 3

encode_len_prefixedFunction · 0.85
pushMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected