From e12230d543caeccd5e7bfb509d58c230d336a79a Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 10 Jun 2022 13:17:50 +0200 Subject: [PATCH] proxmox-metrics: send_data_to_channels: change from slice to IntoIterator which is a bit generic and allows us to use e.g. a map result to be passed here Signed-off-by: Dominik Csapak Signed-off-by: Wolfgang Bumiller --- proxmox-metrics/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxmox-metrics/src/lib.rs b/proxmox-metrics/src/lib.rs index a55f0afc..000cb39c 100644 --- a/proxmox-metrics/src/lib.rs +++ b/proxmox-metrics/src/lib.rs @@ -69,11 +69,12 @@ impl MetricsData { } /// Helper to send a list of [`MetricsData`] to a list of [`Metrics`]. -pub async fn send_data_to_channels( +pub async fn send_data_to_channels<'a, I: IntoIterator>( values: &[Arc], - connections: &[Metrics], + connections: I, ) -> Vec> { - let mut futures = Vec::with_capacity(connections.len()); + let connections = connections.into_iter(); + let mut futures = Vec::with_capacity(connections.size_hint().0); for connection in connections { futures.push(async move { for data in values {