Decode metadata from a single byte. # Arguments `byte` - The encoded metadata byte # Returns Decoded file metadata with default permissions based on type.
(byte: u8)
| 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 | |
| 485 | impl Default for FileMetadata { |
nothing calls this directly
no outgoing calls
no test coverage detected