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