Skip to main content

vfsi_core/api/
mkdir.rs

1use std::path::Path;
2
3/// One directory creation with explicit Unix permission bits.
4/// Construction performs no I/O and can borrow the path without allocating.
5/// Parents must exist; submit independent siblings together with [`super::Vfsi::vmkdir`].
6#[derive(Clone, Copy, Debug)]
7pub struct MkDirOp<P> {
8    path: P,
9    mode: u32,
10}
11
12impl<P: AsRef<Path>> MkDirOp<P> {
13    /// Prepare a directory creation. The backend applies these permission bits
14    /// rather than relying on the process umask.
15    pub fn new(path: P, mode: u32) -> Self {
16        Self { path, mode }
17    }
18
19    /// Directory path in the filesystem's namespace.
20    pub fn path(&self) -> &Path {
21        self.path.as_ref()
22    }
23
24    /// Requested Unix permission bits.
25    pub fn mode(&self) -> u32 {
26        self.mode
27    }
28}