jrpc 0.4.1

types for the jsonrpc specification, ultra lightweight
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate jrpc;
extern crate serde_json;

use jrpc::*;

#[test]
fn test_id() {
    let id: Id = serde_json::from_str("1").unwrap();
    assert_eq!(id, Id::Int(1));

    let id: Id = serde_json::from_str("\"1\"").unwrap();
    assert_eq!(id, Id::String("1".into()));

    let id: Id = serde_json::from_str("null").unwrap();
    assert_eq!(id, Id::Null);
}