rosv

Crates.iorosv
lib.rsrosv
version1.1.0
sourcesrc
created_at2024-01-09 14:53:07.989034
updated_at2024-01-10 16:14:45.260533
descriptionAn implementation of the RSV file format
homepage
repositoryhttps://gitlab.com/bhamlin/rosv
max_upload_size
id1094079
size19,250
Billy J Hamlin (bhamlin)

documentation

README

RoSV - Rows of Serial Values implementation for Rust

I didn't really like the version included in the RSV Challenge repo, so I made my own.

This crate adds functionality to Vec<Vec<Option<String>>> and Vec<Vec<Option<&str>>> for serialization, and to Vec<u8> for deserialization. Bare functions for serialization and deserialization are available in rosv::serialization as well.

use rosv::{DeserializeRoSV, SerializeRoSV};

// Sample data
let rows = vec![
    vec![Some("Hello"), Some("🌎"), None, Some("")],
    vec![Some("A\0B\nC"), Some("Test 𝄞")],
    vec![],
    vec![Some("")],
];

// Return vec as a u8 stream readable by the rosv deserializer.
let stream = rows.serialize_rosv();

// Consume a stream and deserialize to a new vec.
let data = stream.deserialize_rosv().expect("Bad utf-8 in stream");
Commit count: 0

cargo fmt