From b057c46cbe3e2db13fd895cec63e0ee83728bf7b Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 8 Oct 2024 10:42:21 +0200 Subject: [PATCH] add barcodes --- src/variant.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/variant.rs b/src/variant.rs index 03f3dc5..82a3400 100644 --- a/src/variant.rs +++ b/src/variant.rs @@ -43,6 +43,8 @@ pub struct Variant { pub min: Option, /// Days until expiry pub expiry: Option, + /// Associated barcodes + pub barcodes: Option> } impl Variant { @@ -69,6 +71,9 @@ impl Variant { .unwrap() .get("expiry") .map(|x| x.as_i64().unwrap()), + barcodes: json.as_mapping().unwrap().get("barcodes").map(|x| { + x.as_sequence().unwrap().into_iter().map(|x| x.as_i64().unwrap()).collect() + }) } } @@ -294,7 +299,8 @@ impl Variant { "variant": self.variant, "name": self.name, "min": self.min, - "expiry": self.expiry + "expiry": self.expiry, + "barcodes": self.barcodes }) } }