serde_archive

Crates.ioserde_archive
lib.rsserde_archive
version0.1.5
sourcesrc
created_at2022-07-13 08:15:06.280742
updated_at2022-07-13 13:47:47.753586
descriptionarchive serializer for Serde
homepage
repositoryhttps://github.com/resosafe/serde_archive
max_upload_size
id624921
size22,612
Jean Collonvillé (jcollonville)

documentation

README

serde_archive

Archive serializer for Serde

Status

Supports tar and zip formats. Only simple Serialization at the moment: support for Structures, Map<String, T> and primitive types.

Usage

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);
Commit count: 11

cargo fmt