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.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FileEntry<'a>
impl<'a> !Send for FileEntry<'a>
impl<'a> !Sync for FileEntry<'a>
impl<'a> Unpin for FileEntry<'a>
impl<'a> !UnwindSafe for FileEntry<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more