make rules text an Option, it's not always present
This commit is contained in:
parent
1fbb78c915
commit
d0ca8434b5
@ -25,7 +25,7 @@ pub struct MtgCard {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub cost: Option<String>,
|
pub cost: Option<String>,
|
||||||
pub typeline: String,
|
pub typeline: String,
|
||||||
pub rules: String,
|
pub rules: Option<String>,
|
||||||
pub flavor: Option<String>,
|
pub flavor: Option<String>,
|
||||||
pub power: Option<String>,
|
pub power: Option<String>,
|
||||||
pub toughness: Option<String>,
|
pub toughness: Option<String>,
|
||||||
@ -80,7 +80,7 @@ fn parse_entry (page: String) -> Result<MtgCard, Error> {
|
|||||||
name: card_name,
|
name: card_name,
|
||||||
cost: entry["manaCost"].as_str().map(String::from),
|
cost: entry["manaCost"].as_str().map(String::from),
|
||||||
typeline: entry["type"].as_str().map(String::from).expect("expected type in json data"),
|
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"),
|
rules: entry["text"].as_str().map(String::from),
|
||||||
flavor: entry["flavor"].as_str().map(String::from),
|
flavor: entry["flavor"].as_str().map(String::from),
|
||||||
power: entry["power"].as_str().map(String::from),
|
power: entry["power"].as_str().map(String::from),
|
||||||
toughness: entry["toughness"].as_str().map(String::from),
|
toughness: entry["toughness"].as_str().map(String::from),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user