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

Method from_byte

atomic-core/src/record/item.rs:468–482  ·  view source on GitHub ↗

Decode metadata from a single byte. # Arguments `byte` - The encoded metadata byte # Returns Decoded file metadata with default permissions based on type.

(byte: u8)

Source from the content-addressed store, hash-verified

466 ///
467 /// Decoded file metadata with default permissions based on type.
468 pub fn from_byte(byte: u8) -> Self {
469 let is_directory = (byte & 0b01) != 0;
470 let is_executable = (byte & 0b10) != 0;
471
472 let permissions = if is_directory || is_executable {
473 0o755
474 } else {
475 0o644
476 };
477
478 Self {
479 permissions,
480 is_directory,
481 }
482 }
483}
484
485impl Default for FileMetadata {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected