Deserialize less to match schema versions

Currently the entire `Program` is deserialized to match schema versions but this
is likely to fail when the schema changes. Instead just deserialize the
schema/version fields, compare those, and if successful go ahead and deserialize
everything.
This commit is contained in:
Alex Crichton
2018-04-19 13:36:59 -07:00
parent 0ade4b8cac
commit eb73e05b7a
2 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,12 @@ extern crate serde_derive;
pub const SCHEMA_VERSION: &str = "2";
#[derive(Deserialize)]
pub struct ProgramOnlySchema {
pub schema_version: String,
pub version: String,
}
#[derive(Deserialize, Serialize)]
pub struct Program {
pub exports: Vec<Export>,