1 use std::path::PathBuf;
3 use crate::extension::Extension;
6 #[derive(Debug, Clone, PartialEq, Eq)]
8 /// File's (relative) path
10 /// The bytes that compose the file.
11 /// Only used when the whole file is kept in-memory
12 pub contents_in_memory: Option<Vec<u8>>,
13 /// Note: extension here might be a misleading name since
14 /// we don't really care about any extension other than supported compression ones.
16 /// So, for example, if a file has pathname "image.jpeg", it does have a JPEG extension but will
17 /// be represented as a None over here since that's not an extension we're particularly interested in
18 pub extension: Option<Extension>
21 impl From<(PathBuf, Extension)> for File {
22 fn from((path, format): (PathBuf, Extension)) -> Self {
25 contents_in_memory: None,
26 extension: Some(format),