Function rocket_dyn_templates::minijinja::filters::items

source ·
pub fn items(v: Value) -> Result<Value, Error>
Expand description

Returns a list of pairs (items) from a mapping.

This can be used to iterate over keys and values of a mapping at once. Note that this will use the original order of the map which is typically arbitrary unless the preserve_order feature is used in which case the original order of the map is retained. It’s generally better to use |dictsort which sorts the map by key before iterating.

<dl>
{% for key, value in my_dict|items %}
  <dt>{{ key }}
  <dd>{{ value }}
{% endfor %}
</dl>