2016-02-01 14:58:13 +01:00
|
|
|
//! Coversion from json.
|
|
|
|
|
2016-01-14 21:24:16 +01:00
|
|
|
use standard::*;
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! xjson {
|
|
|
|
( $x:expr ) => {
|
|
|
|
FromJson::from_json($x)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-03 14:51:45 +01:00
|
|
|
/// Trait allowing conversion from a JSON value.
|
2016-01-14 21:24:16 +01:00
|
|
|
pub trait FromJson {
|
2016-02-03 14:51:45 +01:00
|
|
|
/// Convert a JSON value to an instance of this type.
|
2016-01-14 21:24:16 +01:00
|
|
|
fn from_json(json: &Json) -> Self;
|
|
|
|
}
|