1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#[derive(Debug, Clone)]
pub(crate) struct DirOptionsExt {
    pub(super) mode: u32,
}

impl DirOptionsExt {
    pub(crate) const fn new() -> Self {
        Self {
            // The default value; see
            // https://doc.rust-lang.org/std/os/unix/fs/trait.DirBuilderExt.html#tymethod.mode
            mode: 0o777,
        }
    }
}

impl std::os::unix::fs::DirBuilderExt for DirOptionsExt {
    fn mode(&mut self, mode: u32) -> &mut Self {
        self.mode = mode;
        self
    }
}