From 088bf404a46481de75be1a0221c96627adc11a40 Mon Sep 17 00:00:00 2001 From: Maciej Malecki Date: Fri, 11 Oct 2024 19:25:46 +0200 Subject: [PATCH] Use BTreeMap when returning the state to keep the order. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/repo.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c5f61c..53964cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,7 +729,7 @@ dependencies = [ [[package]] name = "neuroheat" -version = "0.2.0" +version = "0.2.1" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 18b4dfd..8ac1f6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "neuroheat" -version = "0.2.0" +version = "0.2.1" edition = "2021" [dependencies] diff --git a/src/repo.rs b/src/repo.rs index 91a554d..63ab9a6 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, NaiveDateTime, Utc}; use rusqlite::{params, Connection}; -use std::collections::HashMap; +use std::collections::{BTreeMap, HashMap}; use std::sync::{Arc, Mutex}; use crate::db; @@ -8,7 +8,7 @@ use crate::error::NeuroheatError; pub fn get_current_state( conn: &Arc>, -) -> Result>, NeuroheatError> { +) -> Result>, NeuroheatError> { db::with_locked_connection(conn, |conn| { let mut stmt = conn.prepare( r#" @@ -58,7 +58,7 @@ pub fn get_current_state( } Ok((key, map)) })? - .collect::, _>>()?; + .collect::, _>>()?; let stove_state = conn.query_row( r#"