Skip to content

Commit d2a788a

Browse files
GuillaumeGomezKijewski
authored andcommitted
Add doc about unique filter
1 parent d0d23ca commit d2a788a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

book/src/filters.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,31 @@ Output:
560560
he...
561561
```
562562

563+
### unique
564+
[#unique]: #unique
565+
566+
Returns an iterator with all duplicates removed.
567+
568+
**This filter is only available with the `std` feature enabled.**
569+
570+
With this data:
571+
572+
```rust
573+
vec!["a", "b", "a", "c"]
574+
```
575+
576+
And this template:
577+
578+
```jinja
579+
{% for elem in data|unique %}{{ elem }},{% endfor %}
580+
```
581+
582+
Output will be:
583+
584+
```text
585+
a,b,c,
586+
```
587+
563588
### upper | uppercase
564589
[#upper]: #upper--uppercase
565590

0 commit comments

Comments
 (0)