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: