#[non_exhaustive]pub enum VfFile {
Cwd,
Descriptor(i32),
Path {
base: VfPathBase,
path: PathBuf,
},
CwdPath(PathBuf),
Saved,
}Expand description
A reference to a file: an open descriptor, a path, or a special
pseudo-file. This is the Rust-native form of the C tc_file tagged
struct (type + fd + path), where the variant is the tag.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Cwd
The client’s current working directory (a stat target, but not a file
for read/write). Also the Default placeholder.
Descriptor(i32)
An open file descriptor (backend-assigned).
Path
A path; the VfPathBase records whether it is absolute or relative
to the client’s cwd. Note that the raw path (see
path) does not itself record the base; the filesystem
resolves it while honoring this field.
CwdPath(PathBuf)
A path relative to the client’s current working directory.
Saved
The saved (previous) directory, mirroring the C sentinel. No current backend produces or consumes this; operations on it fail.
Implementations§
Source§impl VfFile
impl VfFile
pub fn from_path(path: &str) -> VfFile
Sourcepub fn from_path_bytes(path: &[u8]) -> VfFile
pub fn from_path_bytes(path: &[u8]) -> VfFile
Construct from arbitrary Unix path bytes.
Sourcepub fn from_os_path(path: &Path) -> VfFile
pub fn from_os_path(path: &Path) -> VfFile
Construct from a native Unix path.
pub fn from_fd(fd: i32) -> VfFile
Sourcepub fn cwd_path(path: impl Into<PathBuf>) -> VfFile
pub fn cwd_path(path: impl Into<PathBuf>) -> VfFile
A path relative to the client’s current working directory.
pub fn saved() -> VfFile
Sourcepub fn is_descriptor(&self) -> bool
pub fn is_descriptor(&self) -> bool
Whether this references an open descriptor.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
The raw path, for Path and CwdPath. This does not resolve
VfPathBase or the client working directory.
Sourcepub fn path_bytes(&self) -> Option<&[u8]>
pub fn path_bytes(&self) -> Option<&[u8]>
The raw bytes of this path, if path-backed.