Struct glean_core::metrics::DatetimeMetric
source · [−]pub struct DatetimeMetric { /* private fields */ }
Expand description
A datetime metric.
Used to record an absolute date and time, such as the time the user first ran the application.
Implementations
sourceimpl DatetimeMetric
impl DatetimeMetric
sourcepub fn new(meta: CommonMetricData, time_unit: TimeUnit) -> Self
pub fn new(meta: CommonMetricData, time_unit: TimeUnit) -> Self
Creates a new datetime metric.
sourcepub fn set_with_details(
&self,
glean: &Glean,
year: i32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32,
nano: u32,
offset_seconds: i32
)
pub fn set_with_details(
&self,
glean: &Glean,
year: i32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32,
nano: u32,
offset_seconds: i32
)
Sets the metric to a date/time including the timezone offset.
Arguments
glean
- the Glean instance this metric belongs to.year
- the year to set the metric to.month
- the month to set the metric to (1-12).day
- the day to set the metric to (1-based).hour
- the hour to set the metric to.minute
- the minute to set the metric to.second
- the second to set the metric to.nano
- the nanosecond fraction to the last whole second.offset_seconds
- the timezone difference, in seconds, for the Eastern Hemisphere. Negative seconds mean Western Hemisphere.
sourcepub fn test_get_value(
&self,
glean: &Glean,
storage_name: &str
) -> Option<Datetime>
pub fn test_get_value(
&self,
glean: &Glean,
storage_name: &str
) -> Option<Datetime>
Test-only API (exported for FFI purposes).
Gets the stored datetime value.
The precision of this value is truncated to the time_unit
precision.
Arguments
glean
- the Glean instance this metric belongs to.storage_name
- the storage name to look into.
Returns
The stored value or None
if nothing stored.
Trait Implementations
sourceimpl Debug for DatetimeMetric
impl Debug for DatetimeMetric
sourceimpl MetricType for DatetimeMetric
impl MetricType for DatetimeMetric
sourcefn meta(&self) -> &CommonMetricData
fn meta(&self) -> &CommonMetricData
Access the stored metadata
sourcefn meta_mut(&mut self) -> &mut CommonMetricData
fn meta_mut(&mut self) -> &mut CommonMetricData
Access the stored metadata mutable
sourcefn should_record(&self, glean: &Glean) -> bool
fn should_record(&self, glean: &Glean) -> bool
Whether this metric should currently be recorded Read more
Auto Trait Implementations
impl RefUnwindSafe for DatetimeMetric
impl Send for DatetimeMetric
impl Sync for DatetimeMetric
impl Unpin for DatetimeMetric
impl UnwindSafe for DatetimeMetric
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more