From d37adbecc540a19971ad75eda26ad904ce39e158 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 10 Mar 2022 16:37:15 -0500 Subject: [PATCH] add comments --- src/misc.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/misc.rs b/src/misc.rs index dedf687..377f477 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -180,13 +180,18 @@ pub fn newtons_method( output_list } +/// Parses a json array of strings into a single, multiline string pub fn parse_value(value: &serde_json::Value) -> String { + // Create vector of strings let string_vector: Vec<&str> = value .as_array() .unwrap() .iter() .map(|ele| ele.as_str().unwrap()) .collect::>(); + + + // Deliminate vector with a new line and return the resulting multiline string string_vector .iter() .fold(String::new(), |s, l| s + l + "\n")