pub enum FileEntry<'a> {
Borrowed(&'a [u8]),
Owned(Bytes),
Reader(Box<dyn Read>),
}
Expand description
Some file-like object which can be written to a WEBC file.
Variants§
Borrowed(&'a [u8])
Bytes borrowed from somewhere else.
Owned(Bytes)
Owned bytes.
Reader(Box<dyn Read>)
A readable object.
Implementations§
source§impl FileEntry<'_>
impl FileEntry<'_>
sourcepub fn from_path(path: impl Into<PathBuf>) -> Result<Self, Error>
pub fn from_path(path: impl Into<PathBuf>) -> Result<Self, Error>
Create a new FileEntry
from a file on disk.
To avoid having too many open file handles at a time, the file will only be opened on the first read.
Beware of time-of-check to time-of-use issues. This function checks that the file exists when first called, but permissions may change or the file may still be deleted/moved/replaced before the first read.