Trait glean_core::traits::ExtraKeys [−][src]
pub trait ExtraKeys: Hash + Eq + PartialEq + Copy { const ALLOWED_KEYS: &'static [&'static str]; fn index(self) -> i32; }
Expand description
Extra keys for events.
Extra keys need to be pre-defined and map to a string representation.
For user-defined EventMetrics these will be defined as enums.
Each variant will correspond to an entry in the ALLOWED_KEYS list.
The Glean SDK requires the keys as strings for submission in pings,
whereas in code we want to provide users a type to work with
(e.g. to avoid typos or misuse of the API).
Associated Constants
const ALLOWED_KEYS: &'static [&'static str][src]
Expand description
List of allowed extra keys as strings.
Required methods
fn index(self) -> i32[src]
Expand description
The index of the extra key.
It corresponds to its position in the associated ALLOWED_KEYS list.
Note: An index of -1 indicates an invalid / non-existing extra key.
Invalid / non-existing extra keys will be recorded as an error.
This cannot happen for generated code.
Implementors
impl ExtraKeys for NoExtraKeys[src]
impl ExtraKeys for NoExtraKeys[src]