Add serde feature and dependency for (de)serialization
This commit is contained in:
parent
f1484a7b66
commit
7997cd9213
|
@ -5,5 +5,9 @@ edition = "2021"
|
|||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
serde = ["dep:serde"]
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.197", features = ["derive"], optional = true }
|
||||
zip = "0.6.6"
|
||||
|
|
|
@ -11,6 +11,7 @@ use zip::ZipWriter;
|
|||
|
||||
/// Folder representation in virtual file system
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct VFolder {
|
||||
folders: HashMap<String, VFolder>,
|
||||
files: HashMap<String, VFile>,
|
||||
|
@ -188,6 +189,7 @@ impl VFolder {
|
|||
|
||||
/// File representation in virtual file system
|
||||
#[derive(Debug, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum VFile {
|
||||
/// Text file
|
||||
Text(String),
|
||||
|
|
Loading…
Reference in New Issue