From cfe27a7149564721ee6693d8352c953e564d9355 Mon Sep 17 00:00:00 2001 From: Ryan Ruckley Date: Tue, 28 Nov 2023 09:49:30 +1100 Subject: [PATCH] CostEntry with default --- src/tmf7xx/cost.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tmf7xx/cost.rs b/src/tmf7xx/cost.rs index d214cbab..f573ff65 100644 --- a/src/tmf7xx/cost.rs +++ b/src/tmf7xx/cost.rs @@ -7,6 +7,20 @@ use super::MOD_PATH; const COST_PATH : &str = "cost"; +/// Price structure +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct CostEntry { + unit : String, + amount : f32, +} + +impl Default for CostEntry { + fn default() -> Self { + CostEntry { unit: "Dollars".to_owned(), amount: 1.0 } + } +} + /// Cost Management #[derive(Clone, Default, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -19,6 +33,8 @@ pub struct Cost { pub name: Option, /// Validity pub valid_for: Option, + /// Cost Value + pub cost : CostEntry, } impl Cost {