From cd391a233d3259fca8e0917d170ca9b43c69b5f7 Mon Sep 17 00:00:00 2001 From: Mutzi Date: Sat, 27 Jan 2024 14:42:05 +0100 Subject: [PATCH] Also replace HashMap with LinkedHashMap to keep service order --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/main.rs | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6b82b3..f0921d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,6 +220,12 @@ version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "log" version = "0.4.20" @@ -250,6 +256,7 @@ dependencies = [ "graph-cycles", "hhmmss", "libc", + "linked-hash-map", "nix", "petgraph", "serde", diff --git a/Cargo.toml b/Cargo.toml index 4810c66..e259c73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ daemonize = "0.5.0" serde = { version = "1.0", features = ["derive"] } toml = { version = "0.8.8", features = ["preserve_order"] } +linked-hash-map = "0.5.6" shlex = "1.3.0" petgraph = "0.6.4" diff --git a/src/main.rs b/src/main.rs index 466f49b..73a8026 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ struct Data { pub epoll: nix::sys::epoll::Epoll, pub sigfd: nix::sys::signalfd::SignalFd, pub work_queue: Option>, - pub services: std::collections::HashMap + pub services: linked_hash_map::LinkedHashMap } impl Data { fn new() -> Self { @@ -35,7 +35,7 @@ impl Data { epoll, sigfd, work_queue: None, - services: std::collections::HashMap::new() + services: Default::default() } }