From feeed45aae11a238de910805fe47e1cceca3620c Mon Sep 17 00:00:00 2001 From: "Osma S. Rautila" Date: Mon, 6 Jan 2025 19:52:41 +0200 Subject: [PATCH] feat(cable) keep data input order --- crates/television-channels/Cargo.toml | 1 + crates/television-channels/src/channels/cable.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/television-channels/Cargo.toml b/crates/television-channels/Cargo.toml index 2b940ed..bb440bc 100644 --- a/crates/television-channels/Cargo.toml +++ b/crates/television-channels/Cargo.toml @@ -29,6 +29,7 @@ strum = { version = "0.26.3", features = ["derive"] } lazy_static = "1.5.0" toml = "0.8.19" regex = "1.11.1" +indexmap = "2.7.0" [lints] workspace = true diff --git a/crates/television-channels/src/channels/cable.rs b/crates/television-channels/src/channels/cable.rs index 66a1afe..b2adbd3 100644 --- a/crates/television-channels/src/channels/cable.rs +++ b/crates/television-channels/src/channels/cable.rs @@ -1,7 +1,7 @@ use color_eyre::Result; +use indexmap::IndexSet; use lazy_static::lazy_static; use regex::Regex; -use std::collections::HashSet; use tracing::debug; use crate::cable::{CableChannelPrototype, DEFAULT_DELIMITER}; @@ -108,7 +108,7 @@ async fn load_candidates(command: String, injector: Injector) { let decoded_output = String::from_utf8(output.stdout).unwrap(); debug!("Decoded output: {:?}", decoded_output); - for line in decoded_output.lines().collect::>() { + for line in decoded_output.lines().collect::>() { if !line.trim().is_empty() { let () = injector.push(line.to_string(), |e, cols| { cols[0] = e.clone().into();