Implement file filters via dbus

This commit is contained in:
Kovid Goyal 2025-07-06 12:17:09 +05:30
parent 0a9d83e11b
commit ebe9842291
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 76 additions and 8 deletions

View file

@ -158,6 +158,18 @@ func StableSort[T any](s []T, cmp func(a, b T) int) []T {
return s
}
func Uniq[T comparable](s []T) []T {
seen := NewSet[T](len(s))
ans := make([]T, 0, len(s))
for _, x := range s {
if !seen.Has(x) {
seen.Add(x)
ans = append(ans, x)
}
}
return ans
}
func sort_with_key[T any, C constraints.Ordered](stable bool, s []T, key func(a T) C) []T {
type t struct {
key C