mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Return BTreeMap instead of HashMap from get_info()
BTreeMap is sorted by keys when iterated, making it easier to find the required line.
This commit is contained in:
@@ -13,7 +13,7 @@ extern crate human_panic;
|
|||||||
extern crate num_traits;
|
extern crate num_traits;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::BTreeMap;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
@@ -434,7 +434,7 @@ pub unsafe extern "C" fn dc_get_info(context: *mut dc_context_t) -> *mut libc::c
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render_info(
|
fn render_info(
|
||||||
info: HashMap<&'static str, String>,
|
info: BTreeMap<&'static str, String>,
|
||||||
) -> std::result::Result<String, std::fmt::Error> {
|
) -> std::result::Result<String, std::fmt::Error> {
|
||||||
let mut res = String::new();
|
let mut res = String::new();
|
||||||
for (key, value) in &info {
|
for (key, value) in &info {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Context module
|
//! Context module
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Condvar, Mutex, RwLock};
|
use std::sync::{Arc, Condvar, Mutex, RwLock};
|
||||||
@@ -73,8 +73,8 @@ pub struct RunningState {
|
|||||||
/// actual keys and their values which will be present are not
|
/// actual keys and their values which will be present are not
|
||||||
/// guaranteed. Calling [Context::get_info] also includes information
|
/// guaranteed. Calling [Context::get_info] also includes information
|
||||||
/// about the context on top of the information here.
|
/// about the context on top of the information here.
|
||||||
pub fn get_info() -> HashMap<&'static str, String> {
|
pub fn get_info() -> BTreeMap<&'static str, String> {
|
||||||
let mut res = HashMap::new();
|
let mut res = BTreeMap::new();
|
||||||
res.insert("deltachat_core_version", format!("v{}", &*DC_VERSION_STR));
|
res.insert("deltachat_core_version", format!("v{}", &*DC_VERSION_STR));
|
||||||
res.insert("sqlite_version", rusqlite::version().to_string());
|
res.insert("sqlite_version", rusqlite::version().to_string());
|
||||||
res.insert("arch", (std::mem::size_of::<usize>() * 8).to_string());
|
res.insert("arch", (std::mem::size_of::<usize>() * 8).to_string());
|
||||||
@@ -225,7 +225,7 @@ impl Context {
|
|||||||
* UI chat/message related API
|
* UI chat/message related API
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
pub fn get_info(&self) -> HashMap<&'static str, String> {
|
pub fn get_info(&self) -> BTreeMap<&'static str, String> {
|
||||||
let unset = "0";
|
let unset = "0";
|
||||||
let l = LoginParam::from_database(self, "");
|
let l = LoginParam::from_database(self, "");
|
||||||
let l2 = LoginParam::from_database(self, "configured_");
|
let l2 = LoginParam::from_database(self, "configured_");
|
||||||
|
|||||||
Reference in New Issue
Block a user