Skip to content

Commit

Permalink
Generate new UniFFI-compatible interface for event keys (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
badboy authored Jun 3, 2022
1 parent 33a9675 commit 87079af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions glean_parser/templates/rust.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32, String> {
fn into_ffi_extra(self) -> ::std::collections::HashMap<String, String> {
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
}
Expand Down

0 comments on commit 87079af

Please sign in to comment.