Skip to content
Snippets Groups Projects
Commit fa2dd0b5 authored by Maaz Ahmed's avatar Maaz Ahmed
Browse files

Merge branch '7-duration-struct-s-fields-are-private' into 'main'

Resolve "Duration struct's fields are private"

Closes #7

See merge request subcom/mquery!5
parents 4883f858 568b7b9e
No related branches found
No related tags found
1 merge request!5Resolve "Duration struct's fields are private"
Pipeline #14316 passed with stages
in 29 minutes and 41 seconds
...@@ -225,7 +225,7 @@ impl Display for Unit { ...@@ -225,7 +225,7 @@ impl Display for Unit {
/// Specify lookback / range duration for the queries /// Specify lookback / range duration for the queries
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Duration(u64, Unit); pub struct Duration(pub u64, pub Unit);
impl Display for Duration { impl Display for Duration {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
...@@ -233,6 +233,12 @@ impl Display for Duration { ...@@ -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 /// Specify time offset for the queries
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Offset(i64, Unit); pub struct Offset(i64, Unit);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment