pub enum FileData {
Path(PathBuf),
Memory(Vec<u8>),
}
Expand description
Represents an abstract location for binary data.
Data can be backed by the filesystem or in memory.
Variants§
Implementations§
Source§impl FileData
impl FileData
Sourcepub fn resolve_content(&self) -> Result<Vec<u8>, Error>
pub fn resolve_content(&self) -> Result<Vec<u8>, Error>
Resolve the data for this instance.
If backed by a file, the file will be read.
Sourcepub fn to_memory(&self) -> Result<Self, Error>
pub fn to_memory(&self) -> Result<Self, Error>
Convert this instance to a memory variant.
This ensures any file-backed data is present in memory.
Sourcepub fn backing_path(&self) -> Option<&Path>
pub fn backing_path(&self) -> Option<&Path>
Obtain a filesystem path backing this content.
Trait Implementations§
impl StructuralPartialEq for FileData
Auto Trait Implementations§
impl Freeze for FileData
impl RefUnwindSafe for FileData
impl Send for FileData
impl Sync for FileData
impl Unpin for FileData
impl UnwindSafe for FileData
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