Skip to content

Commit

Permalink
Implements default trait for new ValueConf (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell authored Oct 23, 2023
1 parent ad6fdcc commit 3e11db1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lading_payload/src/dogstatsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ fn contexts() -> ConfRange<u32> {
}

fn value_config() -> ValueConf {
ValueConf {
float_probability: 0.5, // 50%
range: ConfRange::Inclusive {
min: i64::MIN,
max: i64::MAX,
},
}
ValueConf::default()
}

// https://docs.datadoghq.com/developers/guide/what-best-practices-are-recommended-for-naming-metrics-and-tags/#rules-and-best-practices-for-naming-metrics
Expand Down Expand Up @@ -120,6 +114,17 @@ pub struct ValueConf {
range: ConfRange<i64>,
}

impl Default for ValueConf {
fn default() -> Self {
Self {
float_probability: 0.5, // 50%
range: ConfRange::Inclusive {
min: i64::MIN,
max: i64::MAX,
},
}
}
}
/// Range expression for configuration
#[derive(Debug, Deserialize, Clone, PartialEq, Copy)]
#[serde(rename_all = "snake_case")]
Expand Down

0 comments on commit 3e11db1

Please sign in to comment.