#serde-json #validation #serde #json #deserialize #object

serdeval

Serde dummy types for fast and memory efficient typed validation

1 unstable release

0.1.0 Jul 29, 2021

#184 in #serde-json

Custom license

275KB
326 lines

SerdeVal

A serde validator

Overview

SerdeVal allows you to validate data that can be deserialized using serde, whithout actually deserializing to anything. This is usefull when you only want to validate that some data can be deserialized to some type. SerdeVal doesn't allocate anything, so it is extremely efficient for validating large files from disk:

use std::io::File;

use serdeval::*;

// we want to check that the very_big.json is an arrray of javascript objects:
fn main() {
	let json = File::open("very_big.json").unwrap();
	let _: Seq<Map<Str, Any>> = serde_json::from_reader(json).unwarp();
}

License: MIT


lib.rs:

SerdeVal

A serde validator

Overview

SerdeVal allows you to validate data that can be deserialized using serde, whithout actually deserializing to anything. This is usefull when you only want to validate that some data can be deserialized to some type. SerdeVal doesn't allocate anything, so it is extremely efficient for validating large files from disk:

use std::io::File;

use serdeval::*;

// we want to check that the very_big.json is an arrray of javascript objects:
fn main() {
	let json = File::open("very_big.json").unwrap();
	let _: Seq<Map<Str, Any>> = serde_json::from_reader(json).unwarp();
}

License: MIT

Dependencies