[pbs-devel] applied: [PATCH proxmox v9 1/1] proxmox-metrics: send_data_to_channels: change from slice to IntoIterator

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Jun 13 10:04:32 CEST 2022


applied and bumped metrics to 0.2
(will fixup the Cargo.toml entry in the other patches)

On Fri, Jun 10, 2022 at 01:17:50PM +0200, Dominik Csapak wrote:
> 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 at proxmox.com>
> ---
>  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 a55f0af..000cb39 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<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 {
> -- 
> 2.30.2





More information about the pbs-devel mailing list