Trait glean::traits::ExtraKeys[][src]

pub trait ExtraKeys: PartialEq<Self> + Eq + Copy + Hash {
    pub const ALLOWED_KEYS: &'static [&'static str];

    pub fn index(self) -> i32;
}

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

pub const ALLOWED_KEYS: &'static [&'static str][src]

List of allowed extra keys as strings.

Loading content...

Required methods

pub fn index(self) -> i32[src]

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.

Loading content...

Implementors

impl ExtraKeys for NoExtraKeys[src]

Loading content...