FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    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)).

    Source

    ascending

    fn ascending<V: PartialOrd + 'static>(expression: impl Fn(&T) -> V + 'static) -> Self
    

    The key expression, ascending (SortExpression(Func<T, IComparable>)).

    Source

    direction

    fn direction(self: &Self) -> SortDirection
    

    The direction (Direction).

    Source

    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))).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • Clone
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.