1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use inherent::inherent;
#[derive(Clone, Debug)]
pub struct PingType {
pub(crate) name: String,
pub(crate) ping_type: glean_core::metrics::PingType,
}
impl PingType {
pub fn new<A: Into<String>>(
name: A,
include_client_id: bool,
send_if_empty: bool,
reason_codes: Vec<String>,
) -> Self {
let name = name.into();
let ping_type = glean_core::metrics::PingType::new(
name.clone(),
include_client_id,
send_if_empty,
reason_codes,
);
let me = Self { name, ping_type };
crate::register_ping_type(&me);
me
}
}
#[inherent(pub)]
impl glean_core::traits::Ping for PingType {
fn submit(&self, reason: Option<&str>) {
crate::submit_ping(self, reason)
}
}