From 1c4dea7b275a60e4ac6581d07d1de8e0392839aa Mon Sep 17 00:00:00 2001 From: Pakin Date: Mon, 3 Nov 2025 11:25:11 +0700 Subject: [PATCH] Add as single line string for MenuToppingList Signed-off-by: Pakin --- src/models/recipe.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/models/recipe.rs b/src/models/recipe.rs index ef95be6..2fd4bdd 100644 --- a/src/models/recipe.rs +++ b/src/models/recipe.rs @@ -1932,6 +1932,28 @@ pub struct MenuToppingList { // pub extra: std::collections::HashMap, } +impl MenuToppingList { + pub fn to_single_line(&mut self) -> String { + format!( + "#__ListGroupID={:?},defaultIDSelect={},groupID={},isUse={}", + self.ListGroupID + .clone() + .unwrap_or_default() + .iter() + .map(|gid| gid.as_i64().unwrap().to_string()) + .collect::>(), + self.defaultIDSelect.as_i64().unwrap(), + self.groupID + .clone() + .unwrap_or_default() + .as_str() + .unwrap() + .to_string(), + self.isUse + ) + } +} + /// The `Topping` struct represents a collection of topping groups and topping lists. /// /// Properties: