SortExpression
struct · ferroui-dynamic-data · v0.5.0
struct SortExpression<T>
One key of a sort: a value read from each item, and the direction (SortExpression<T>).
Deviation (DEVIATIONS.md, DynamicData): upstream holds the getter Func<T, IComparable>; Rust
has no common type of the values of different getters, so the expression is held as the
comparison of the values it reads. The values need PartialOrd; Option puts None first,
as upstream puts null first, and two values without an order (a NaN) compare as equal.
Members
new
fn new<V: PartialOrd + 'static>(expression: impl Fn(&T) -> V + 'static, direction: SortDirection) -> Self
The key expression in direction (SortExpression(Func<T, IComparable>, SortDirection)).
ascending
fn ascending<V: PartialOrd + 'static>(expression: impl Fn(&T) -> V + 'static) -> Self
The key expression, ascending (SortExpression(Func<T, IComparable>)).
direction
fn direction(self: &Self) -> SortDirection
The direction (Direction).
compare_values
fn compare_values(self: &Self, x: &T, y: &T) -> Ordering
The comparison of the values that the expression reads from x and y, ascending
(Expression(x).CompareTo(Expression(y))).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedCloneDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.