owl-structural-model 2.0.4

Typed OWL 2 structural values for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
use std::fmt::Debug;

use serde::{Serialize, de::DeserializeOwned};

pub fn assert_round_trip<T: Serialize + DeserializeOwned + PartialEq + Debug>(value: &T) {
    let json = serde_json::to_string(value).unwrap();
    assert_eq!(&serde_json::from_str::<T>(&json).unwrap(), value);
    let bytes = postcard::to_allocvec(value).unwrap();
    assert_eq!(&postcard::from_bytes::<T>(&bytes).unwrap(), value);
}