mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-14 03:29:12 +00:00
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 <d.csapak@proxmox.com> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
7667e549a5
commit
e12230d543
@ -69,11 +69,12 @@ impl MetricsData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to send a list of [`MetricsData`] to a list of [`Metrics`].
|
/// 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<Item = &'a Metrics>>(
|
||||||
values: &[Arc<MetricsData>],
|
values: &[Arc<MetricsData>],
|
||||||
connections: &[Metrics],
|
connections: I,
|
||||||
) -> Vec<Result<(), Error>> {
|
) -> Vec<Result<(), Error>> {
|
||||||
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 {
|
for connection in connections {
|
||||||
futures.push(async move {
|
futures.push(async move {
|
||||||
for data in values {
|
for data in values {
|
||||||
|
Loading…
Reference in New Issue
Block a user