feat(modulo): sort search items

This commit is contained in:
Federico Terzi 2021-08-24 20:05:00 +02:00
parent 9b52a06a8b
commit 0cc52ccf63

View File

@ -21,7 +21,7 @@ use crate::search::config::SearchConfig;
use crate::sys::search::types;
pub fn generate(config: SearchConfig) -> types::Search {
let items = config
let mut items: Vec<types::SearchItem> = config
.items
.into_iter()
.map(|item| types::SearchItem {
@ -32,6 +32,8 @@ pub fn generate(config: SearchConfig) -> types::Search {
})
.collect();
items.sort_by(|a, b| a.label.as_str().cmp(b.label.as_str()));
types::Search {
title: config.title,
items,