Function desc [src]
Use to generate a comparator function for a given type. e.g. sort(u8, slice, {}, desc(u8)).
Prototype
pub fn desc(comptime T: type) fn (void, T, T) bool
Parameters
T: type
Source
pub fn desc(comptime T: type) fn (void, T, T) bool {
return struct {
pub fn inner(_: void, a: T, b: T) bool {
return a > b;
}
}.inner;
}