Skip to content

Instantly share code, notes, and snippets.

Created March 7, 2017 16:55
Show Gist options
  • Save anonymous/02f1363e390dc563e42a62aed2d50880 to your computer and use it in GitHub Desktop.
Save anonymous/02f1363e390dc563e42a62aed2d50880 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
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