From 1fbb78c9158f8c9326a14ef2cd8834af3d709711 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Tue, 16 May 2017 21:37:54 -0500 Subject: [PATCH] mana cost is optional --- src/searchers/mtg.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/searchers/mtg.rs b/src/searchers/mtg.rs index 7bd9bf8..d0ff148 100644 --- a/src/searchers/mtg.rs +++ b/src/searchers/mtg.rs @@ -23,7 +23,7 @@ const RETRY_WAIT_MILLIS: u64 = 500; #[derive(Debug)] pub struct MtgCard { pub name: String, - pub cost: String, + pub cost: Option, pub typeline: String, pub rules: String, pub flavor: Option, @@ -78,7 +78,7 @@ fn parse_entry (page: String) -> Result { return Result::Ok(MtgCard { name: card_name, - cost: entry["manaCost"].as_str().map(String::from).expect("expected cost in json data"), + cost: entry["manaCost"].as_str().map(String::from), typeline: entry["type"].as_str().map(String::from).expect("expected type in json data"), rules: entry["text"].as_str().map(String::from).expect("expected text in json data"), flavor: entry["flavor"].as_str().map(String::from),