mirror of
https://git.proxmox.com/git/proxmox
synced 2025-04-28 11:44:39 +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`].
|
||||
pub async fn send_data_to_channels(
|
||||
pub async fn send_data_to_channels<'a, I: IntoIterator<Item = &'a Metrics>>(
|
||||
values: &[Arc<MetricsData>],
|
||||
connections: &[Metrics],
|
||||
connections: I,
|
||||
) -> 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 {
|
||||
futures.push(async move {
|
||||
for data in values {
|
||||
|
Loading…
Reference in New Issue
Block a user