Crates.io | rosv |
lib.rs | rosv |
version | 1.1.0 |
source | src |
created_at | 2024-01-09 14:53:07.989034 |
updated_at | 2024-01-10 16:14:45.260533 |
description | An implementation of the RSV file format |
homepage | |
repository | https://gitlab.com/bhamlin/rosv |
max_upload_size | |
id | 1094079 |
size | 19,250 |
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");