iso9660/directory/
flags.rs1use crate::types::FileFlags;
4
5impl FileFlags {
6 pub fn from_byte(byte: u8) -> Self {
8 Self {
9 hidden: byte & 0x01 != 0,
10 directory: byte & 0x02 != 0,
11 associated: byte & 0x04 != 0,
12 extended_format: byte & 0x08 != 0,
13 extended_permissions: byte & 0x10 != 0,
14 not_final: byte & 0x80 != 0,
15 }
16 }
17
18 pub fn to_byte(&self) -> u8 {
20 let mut byte = 0u8;
21 if self.hidden { byte |= 0x01; }
22 if self.directory { byte |= 0x02; }
23 if self.associated { byte |= 0x04; }
24 if self.extended_format { byte |= 0x08; }
25 if self.extended_permissions { byte |= 0x10; }
26 if self.not_final { byte |= 0x80; }
27 byte
28 }
29}
30
31impl Default for FileFlags {
32 fn default() -> Self {
33 Self {
34 hidden: false,
35 directory: false,
36 associated: false,
37 extended_format: false,
38 extended_permissions: false,
39 not_final: false,
40 }
41 }
42}