Trait glean_core::traits::ExtraKeys

source ·
pub trait ExtraKeys {
    const ALLOWED_KEYS: &'static [&'static str];

    // Required method
    fn into_ffi_extra(self) -> HashMap<String, String>;
}
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 structs. Each extra key will be a field in that struct. Each field 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).

Required Associated Constants§

source

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

List of allowed extra keys as strings.

Required Methods§

source

fn into_ffi_extra(self) -> HashMap<String, String>

Convert the event extras into 2 lists:

  1. The list of extra key indices. Unset keys will be skipped.
  2. The list of extra values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ExtraKeys for NoExtraKeys

source§

const ALLOWED_KEYS: &'static [&'static str] = _