#[non_exhaustive]pub enum FileOperand {
Cwd,
Fd(Fd),
Path {
base: VfPathBase,
path: PathBuf,
},
CwdPath(PathBuf),
Saved,
}Expand description
Native backend operand: a File Descriptor, path, or special directory target.
This selects an operation target without owning its open instance. Cloning
a File Descriptor operand neither duplicates the open instance nor acquires
cleanup ownership. Application callers use crate::api::Target instead.
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.
Fd(Fd)
Backend-assigned File Descriptor referring to an existing open instance.
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 FileOperand
impl FileOperand
pub fn from_path(path: &str) -> FileOperand
Sourcepub fn from_path_bytes(path: &[u8]) -> FileOperand
pub fn from_path_bytes(path: &[u8]) -> FileOperand
Construct from arbitrary Unix path bytes.
Sourcepub fn from_os_path(path: &Path) -> FileOperand
pub fn from_os_path(path: &Path) -> FileOperand
Construct from a native Unix path.
pub fn from_fd(fd: Fd) -> FileOperand
Sourcepub fn cwd() -> FileOperand
pub fn cwd() -> FileOperand
VF_FILE_CURRENT: the client’s current working directory itself.
Sourcepub fn cwd_path(path: impl Into<PathBuf>) -> FileOperand
pub fn cwd_path(path: impl Into<PathBuf>) -> FileOperand
A path relative to the client’s current working directory.
pub fn saved() -> FileOperand
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.