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)]
7#[must_use = "configuration and requests have no effect until used"]
8pub struct MkDirOp<P> {
9    path: P,
10    mode: u32,
11}
12
13impl<P: AsRef<Path>> MkDirOp<P> {
14    /// Prepare a directory creation. The backend applies these permission bits
15    /// rather than relying on the process umask.
16    pub fn new(path: P, mode: u32) -> Self {
17        Self { path, mode }
18    }
19
20    /// Directory path in the filesystem's namespace.
21    pub fn path(&self) -> &Path {
22        self.path.as_ref()
23    }
24
25    /// Requested Unix permission bits.
26    pub fn mode(&self) -> u32 {
27        self.mode
28    }
29}