diff options
-rw-r--r-- | src/dabmux.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dabmux.rs b/src/dabmux.rs index b5913d1..81f6d4a 100644 --- a/src/dabmux.rs +++ b/src/dabmux.rs @@ -11,8 +11,6 @@ * * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use std::collections::HashMap; - use anyhow::anyhow; use serde::Deserialize; use serde_json::Value; @@ -173,15 +171,17 @@ impl DabMux { match values_json.get("values") .and_then(|v| v.as_object()) { Some(v) => { - let mut input_stats : HashMap<String, InputStat> = HashMap::new(); + let mut input_stats : Vec<(String, InputStat)> = Vec::new(); for (k, v) in v { let is = v.get("inputstat") .ok_or(anyhow!("inputstat missing"))?; let stat : InputStat = serde_json::from_value(is.clone())?; - input_stats.insert(k.clone(), stat); + input_stats.push((k.clone(), stat)); } + input_stats.sort_by_key(|v| v.0.clone()); + Ok(Stats { version, input_stats }) }, None => Err(anyhow!("values isn't an object")), @@ -196,7 +196,7 @@ impl DabMux { #[derive(Debug)] pub struct Stats { pub version : String, - pub input_stats : HashMap<String, InputStat>, + pub input_stats : Vec<(String, InputStat)>, } #[derive(Debug, Deserialize)] |