-
-
Save adamscott/bb60213aeaa6f7bb519d54c4a3173167 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate serde; | |
#[macro_use] | |
extern crate serde_json; | |
#[macro_use] | |
extern crate serde_derive; | |
use serde_json::Value; | |
#[derive(Serialize, Deserialize)] | |
struct SearchResponse { | |
resultCount: String, | |
results: Vec<Result> | |
} | |
#[derive(Serialize, Deserialize)] | |
struct Result { | |
#[serde(skip_serializing_if="Option::is_none")] | |
legislation: Option<LegislationResult>, | |
#[serde(skip_serializing_if="Option::is_none")] | |
case: Option<CaseResult> | |
} | |
#[derive(Serialize, Deserialize)] | |
struct LegislationResult { | |
databaseId: String, | |
legislationId: String, | |
title: String, | |
citation: String, | |
#[serde(rename = "type")] | |
legislationType: String | |
} | |
#[derive(Serialize, Deserialize)] | |
struct CaseResult { | |
databaseId: String, | |
caseId: String, | |
title: String, | |
citation: String | |
} | |
fn main() { | |
println!("Hello, world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment