From 504d37bd5911254b5825ae6b44dbea6bf7e9067e Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Fri, 3 Jun 2022 17:43:05 +0200 Subject: [PATCH] Generate new UniFFI-compatible interface for event keys --- glean_parser/templates/rust.jinja2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glean_parser/templates/rust.jinja2 b/glean_parser/templates/rust.jinja2 index 15cef798a..ab66244d1 100644 --- a/glean_parser/templates/rust.jinja2 +++ b/glean_parser/templates/rust.jinja2 @@ -32,10 +32,10 @@ pub struct {{ obj.name|Camelize }}{{ suffix }} { impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} { const ALLOWED_KEYS: &'static [&'static str] = {{ obj.allowed_extra_keys|extra_keys }}; - fn into_ffi_extra(self) -> ::std::collections::HashMap { + fn into_ffi_extra(self) -> ::std::collections::HashMap { let mut map = ::std::collections::HashMap::new(); {% for key, _ in obj|attr(name) %} - self.{{key|snake_case}}.and_then(|val| map.insert({{loop.index-1}}, val)); + self.{{key|snake_case}}.and_then(|val| map.insert("{{key}}", val)); {% endfor %} map }