mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-23 10:04:21 +00:00
Rename associated_card_refs
to associated_card_codes
This commit is contained in:
parent
0f25aaebc4
commit
4a8a5e36bb
1 changed files with 5 additions and 3 deletions
|
@ -5,8 +5,10 @@ use std::collections::HashMap;
|
||||||
#[serde(rename_all="camelCase")]
|
#[serde(rename_all="camelCase")]
|
||||||
pub struct Card {
|
pub struct Card {
|
||||||
/// Codes of other cards associated with this one.
|
/// Codes of other cards associated with this one.
|
||||||
/// To access
|
///
|
||||||
pub associated_card_refs: Vec<String>,
|
/// To access references to the cards themselves, use [associated_cards].
|
||||||
|
#[serde(rename = "associated_card_refs")]
|
||||||
|
pub associated_card_codes: Vec<String>,
|
||||||
|
|
||||||
/// Art assets of this card.
|
/// Art assets of this card.
|
||||||
pub assets: Vec<Asset>,
|
pub assets: Vec<Asset>,
|
||||||
|
@ -78,7 +80,7 @@ pub struct Card {
|
||||||
impl Card {
|
impl Card {
|
||||||
/// Get references to the cards associated with this one, given an hashmap of all cards.
|
/// Get references to the cards associated with this one, given an hashmap of all cards.
|
||||||
pub fn associated_cards<'c, 'hm: 'c>(&'c self, hashmap: &'hm HashMap<String, Card>) -> impl Iterator<Item=Option<&'hm Card>> + 'c {
|
pub fn associated_cards<'c, 'hm: 'c>(&'c self, hashmap: &'hm HashMap<String, Card>) -> impl Iterator<Item=Option<&'hm Card>> + 'c {
|
||||||
self.associated_card_refs.iter().map(|r| hashmap.get(r))
|
self.associated_card_codes.iter().map(|r| hashmap.get(r))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue