spreadsheet_ods/
manifest.rs1use get_size2::GetSize;
6
7#[derive(Debug, Clone, GetSize)]
9pub struct Manifest {
10 pub full_path: String,
12 pub version: Option<String>,
14 pub media_type: String,
16 pub buffer: Option<Vec<u8>>,
19}
20
21impl Default for Manifest {
22 fn default() -> Self {
23 Self {
24 full_path: "".to_string(),
25 version: None,
26 media_type: "".to_string(),
27 buffer: None,
28 }
29 }
30}
31
32impl Manifest {
33 pub fn new<S: Into<String>, T: Into<String>>(full_path: S, media_type: T) -> Self {
35 Self {
36 full_path: full_path.into(),
37 version: None,
38 media_type: media_type.into(),
39 buffer: None,
40 }
41 }
42
43 pub fn with_buf<S: Into<String>, T: Into<String>>(
45 full_path: S,
46 media_type: T,
47 buf: Vec<u8>,
48 ) -> Self {
49 Self {
50 full_path: full_path.into(),
51 version: None,
52 media_type: media_type.into(),
53 buffer: Some(buf),
54 }
55 }
56
57 pub fn is_dir(&self) -> bool {
59 self.full_path.ends_with('/')
60 }
61}