pub enum FileData {
Bytes(Vec<u8>),
Path(PathBuf),
}Expand description
File content — either in-memory bytes or a path on disk.
Small outputs (images, CSVs, renamed files) use Bytes. Large outputs
from shell-command file mode use Path to avoid reading multi-GB files
into memory. Consumers call write_to() which uses rename() (O(1))
for the Path variant with a copy fallback for cross-device moves.
Variants§
Bytes(Vec<u8>)
In-memory file content (images, CSVs, small outputs).
Path(PathBuf)
Reference to a file on disk (shell-command file-mode outputs).
The file is NOT read into memory until into_bytes() is called.
Implementations§
Source§impl FileData
impl FileData
Sourcepub fn write_to(&self, dest: &Path) -> Result<(), Error>
pub fn write_to(&self, dest: &Path) -> Result<(), Error>
Move or write file content to a destination path.
Path variant attempts rename() first (O(1) on same filesystem),
falling back to copy+delete for cross-device moves.
Bytes variant writes data directly.
Sourcepub fn len(&self) -> Result<u64, Error>
pub fn len(&self) -> Result<u64, Error>
Byte length without loading into memory.
Bytes returns the vec length. Path reads file metadata.