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

Function read_timestamp

atomic-core/src/pristine/file_index_v2.rs:389–402  ·  view source on GitHub ↗
(
    src: &[u8],
    fields: FileIndexV2Fields,
    field: FileIndexV2Fields,
)

Source from the content-addressed store, hash-verified

387 .then(|| u16::from_le_bytes(src.try_into().unwrap()))
388}
389fn read_timestamp(
390 src: &[u8],
391 fields: FileIndexV2Fields,
392 field: FileIndexV2Fields,
393) -> PristineResult<Option<FileIndexTimestamp>> {
394 if !fields.contains(field) {
395 return Ok(None);
396 }
397 FileIndexTimestamp::new(
398 i64::from_le_bytes(src[..8].try_into().unwrap()),
399 u32::from_le_bytes(src[8..].try_into().unwrap()),
400 )
401 .map(Some)
402}
403fn read_hash(src: &[u8], fields: FileIndexV2Fields, field: FileIndexV2Fields) -> Option<Hash> {
404 fields
405 .contains(field)

Callers 1

decode_file_index_v2Function · 0.85

Calls 2

containsMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected