| 1 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
//! API definitions for the different metric types supported by the Glean SDK. |
| 6 |
//! |
| 7 |
//! Individual metric types implement this trait to expose the specific metrics API. |
| 8 |
//! It can be used by wrapping implementations to guarantee API conformance. |
| 9 |
|
| 10 |
/// Re-export for use in generated code. |
| 11 |
#[doc(hidden)] |
| 12 |
pub extern crate serde as __serde; |
| 13 |
|
| 14 |
mod boolean; |
| 15 |
mod counter; |
| 16 |
mod custom_distribution; |
| 17 |
mod datetime; |
| 18 |
mod event; |
| 19 |
mod labeled; |
| 20 |
mod memory_distribution; |
| 21 |
mod numerator; |
| 22 |
mod object; |
| 23 |
mod ping; |
| 24 |
mod quantity; |
| 25 |
mod rate; |
| 26 |
mod string; |
| 27 |
mod string_list; |
| 28 |
mod text; |
| 29 |
mod timespan; |
| 30 |
mod timing_distribution; |
| 31 |
mod url; |
| 32 |
mod uuid; |
| 33 |
|
| 34 |
pub use self::boolean::Boolean; |
| 35 |
pub use self::counter::Counter; |
| 36 |
pub use self::custom_distribution::CustomDistribution; |
| 37 |
pub use self::datetime::Datetime; |
| 38 |
pub use self::event::Event; |
| 39 |
pub use self::event::EventRecordingError; |
| 40 |
pub use self::event::ExtraKeys; |
| 41 |
pub use self::event::NoExtraKeys; |
| 42 |
pub use self::labeled::Labeled; |
| 43 |
pub use self::memory_distribution::MemoryDistribution; |
| 44 |
pub use self::numerator::Numerator; |
| 45 |
pub use self::object::{ObjectError, ObjectSerialize}; |
| 46 |
pub use self::ping::Ping; |
| 47 |
pub use self::quantity::Quantity; |
| 48 |
pub use self::rate::Rate; |
| 49 |
pub use self::string::String; |
| 50 |
pub use self::string_list::StringList; |
| 51 |
pub use self::text::Text; |
| 52 |
pub use self::timespan::Timespan; |
| 53 |
pub use self::timing_distribution::TimingDistribution; |
| 54 |
pub use self::url::Url; |
| 55 |
pub use self::uuid::Uuid; |
| 56 |
pub use crate::histogram::HistogramType; |
| 57 |
|
| 58 |
#[doc(hidden)] |
| 59 |
pub mod __serde_helper { |
| 60 |
/// Deserialize value to a `Vec<T>`. |
| 61 |
/// |
| 62 |
/// If the value was `null` return an empty vector. |
| 63 |
pub fn vec_null<'de, D: serde::Deserializer<'de>, T: serde::Deserialize<'de>>( |
| 64 |
d: D, |
| 65 |
) -> Result<Vec<T>, D::Error> { |
| 66 |
let res: Option<Vec<T>> = serde::Deserialize::deserialize(d)?; |
| 67 |
Ok(res.unwrap_or_default()) |
| 68 |
} |
| 69 |
} |