From 8f7f1d6be42218a1845b4af8f8b879691e7ee783 Mon Sep 17 00:00:00 2001 From: PSeitz Date: Tue, 21 Mar 2023 15:02:35 +0800 Subject: [PATCH] add Display for ByteCount (#1949) * add Display for ByteCount * export missing AggregationLimits --- common/src/byte_count.rs | 6 ++++++ src/aggregation/mod.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/common/src/byte_count.rs b/common/src/byte_count.rs index 1aa969dcb..4b346f8cb 100644 --- a/common/src/byte_count.rs +++ b/common/src/byte_count.rs @@ -13,6 +13,12 @@ impl std::fmt::Debug for ByteCount { } } +impl std::fmt::Display for ByteCount { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.human_readable()) + } +} + const SUFFIX_AND_THRESHOLD: [(&str, u64); 5] = [ ("KB", 1_000), ("MB", 1_000_000), diff --git a/src/aggregation/mod.rs b/src/aggregation/mod.rs index 6f0e04d18..76e969e2c 100644 --- a/src/aggregation/mod.rs +++ b/src/aggregation/mod.rs @@ -174,6 +174,7 @@ use std::fmt::Display; #[cfg(test)] mod agg_tests; +pub use agg_limits::AggregationLimits; pub use collector::{ AggregationCollector, AggregationSegmentCollector, DistributedAggregationCollector, DEFAULT_BUCKET_LIMIT,