Skip to content
Snippets Groups Projects

Resolve "Duration struct's fields are private"

Merged Maaz Ahmed requested to merge 7-duration-struct-s-fields-are-private into main
1 file
+ 7
1
Compare changes
  • Side-by-side
  • Inline
+ 7
1
@@ -225,7 +225,7 @@ impl Display for Unit {
/// Specify lookback / range duration for the queries
#[derive(Debug, Clone, Copy)]
pub struct Duration(u64, Unit);
pub struct Duration(pub u64, pub Unit);
impl Display for Duration {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -233,6 +233,12 @@ impl Display for Duration {
}
}
impl From<(u64, Unit)> for Duration {
fn from((time, unit): (u64, Unit)) -> Self {
Duration(time, unit)
}
}
/// Specify time offset for the queries
#[derive(Debug, Clone, Copy)]
pub struct Offset(i64, Unit);
Loading