(&self)
| 33 | |
| 34 | impl FdFlags { |
| 35 | pub fn to_posix(&self) -> i32 { |
| 36 | let mut flags = 0; |
| 37 | if nth_bit_set(self.0, 0) { |
| 38 | flags = bitwise_or(flags, libc::O_APPEND) |
| 39 | } |
| 40 | if nth_bit_set(self.0, 1) { |
| 41 | flags = bitwise_or(flags, libc::O_DSYNC) |
| 42 | } |
| 43 | if nth_bit_set(self.0, 2) { |
| 44 | flags = bitwise_or(flags, libc::O_NONBLOCK) |
| 45 | } |
| 46 | if nth_bit_set(self.0, 3) { |
| 47 | flags = bitwise_or(flags, libc::O_RSYNC) |
| 48 | } |
| 49 | if nth_bit_set(self.0, 4) { |
| 50 | flags = bitwise_or(flags, libc::O_SYNC) |
| 51 | } |
| 52 | flags |
| 53 | } |
| 54 | |
| 55 | pub fn from_posix(flags: i32) -> Self { |
| 56 | // FdFlags(flags as u16) |
nothing calls this directly
no test coverage detected