Crates.io | serde_archive |
lib.rs | serde_archive |
version | 0.1.5 |
source | src |
created_at | 2022-07-13 08:15:06.280742 |
updated_at | 2022-07-13 13:47:47.753586 |
description | archive serializer for Serde |
homepage | |
repository | https://github.com/resosafe/serde_archive |
max_upload_size | |
id | 624921 |
size | 22,612 |
Archive serializer for Serde
Supports tar and zip formats. Only simple Serialization at the moment: support for Structures, Map<String, T> and primitive types.
To use this library, add the following to your Cargo.toml
:
[dependencies]
serde_archive = { version = "0.1", features = ["enable-zip", "enable-tar"], optional = true }
use serde_archive::ser::zip_writer;
use serde_archive::ser::tar_writer;
let item = Item {
name: String::from("test"),
sub: SubItem {
id: 12
}
};
let mut file = std::fs::File::create("/tmp/serde_zip-test.zip").unwrap();
let writer = zip_writer::ZipWriter::new(file, zip_writer::ZipCompression::Bzip2);
serde_archive::to_writer(writer, &item);
let mut file = std::fs::File::create("/tmp/serde_tar-test.tar").unwrap();
let writer = tar_writer::TarWriter::new(file);
serde_archive::to_writer(writer, &item);