Skip to content

Commit 2fdf10d

Browse files
authored
Adds constructors for metric and kind weights (#741)
1 parent 0c37eac commit 2fdf10d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

lading_payload/src/dogstatsd.rs

+27
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ pub struct KindWeights {
9191
service_check: u8,
9292
}
9393

94+
impl KindWeights {
95+
/// Create a new instance of `KindWeights` according to the args
96+
#[must_use]
97+
pub fn new(metric: u8, event: u8, service_check: u8) -> Self {
98+
Self {
99+
metric,
100+
event,
101+
service_check,
102+
}
103+
}
104+
}
105+
94106
impl Default for KindWeights {
95107
fn default() -> Self {
96108
KindWeights {
@@ -115,6 +127,21 @@ pub struct MetricWeights {
115127
histogram: u8,
116128
}
117129

130+
impl MetricWeights {
131+
/// Create a new instance of `MetricWeights` according to the args
132+
#[must_use]
133+
pub fn new(count: u8, gauge: u8, timer: u8, distribution: u8, set: u8, histogram: u8) -> Self {
134+
Self {
135+
count,
136+
gauge,
137+
timer,
138+
distribution,
139+
set,
140+
histogram,
141+
}
142+
}
143+
}
144+
118145
impl Default for MetricWeights {
119146
fn default() -> Self {
120147
MetricWeights {

0 commit comments

Comments
 (0)